Totp fixes (#1153)

Wenhao Wu emailed with the following security report, this affects master and postfixadmin-4.0.

High — mailbox takeover of mail flow for a 2FA-enrolled account by a password holder. CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N ≈ 8.1 (PR:L models possession of the first factor; impact is limited to the attacker's own mailbox account). CWE-308 (Use of Single-Factor Authentication with Two Factors), secondary CWE-287. Not related to the fixed TOTP-exception issue #1014.

....
With `$CONF['totp']='YES'` and a mailbox that has TOTP enrolled, logging in with **only the mailbox password** creates an MFA-incomplete session (`username` set, `roles=[]`, `mfa_complete=false`) that is parked at `users/login-mfa.php`. That half-session cannot open `users/main.php` (it has no `user` role), but `public/edit.php` never checks MFA completion:

- `public/edit.php:30` — `authentication_get_username()` (comment "enforce login") treats any session with a username as logged in; it never calls `authentication_mfa_incomplete()`.
- `public/edit.php:57-63` — for a non-admin session with a handler that has `user_hardcoded_field`, `require_role('admin')` is skipped entirely.
....

Wenhao Wu, Southeast University

thanks @d3do-23 (@cboltz and TrapoSAMA for reviewing etc)
This commit is contained in:
David Goodwin authored and GitHub committed 2026-09-26 09:39:53 +01:00
1 parent 63ef208055
commit 2c05ff950c
41 files changed
+88 -92

No files matched your search

+16 -17
View File
@@ -1,21 +1,10 @@
<?php
/**
* Postfix Admin
*
* LICENSE
* This source file is subject to the GPL license that is bundled with
* this package in the file LICENSE.TXT.
*
* Further details on the project are available at https://github.com/postfixadmin/postfixadmin
*
* @license GNU GPL v2 or later.
*
* File: functions.inc.php
* Contains re-usable code.
* Common re-useable functions for PostfixAdmin.
* @license GPLv2 or later - see LICENSE.TXT and GPL-LICENSE.TXT
*/
$min_db_version = 1855; # update (at least) before a release with the latest function number in upgrade.php
@@ -35,12 +24,12 @@ function authentication_mfa_incomplete(): bool
}
/**
* check_session
* Action: Check if a session already exists, if not redirect to login.php
* Call: check_session ()
* Action: Check if a session already exists, if not redirect to login.php. Returns current user's login.
*
* @param bool $requireMfaComplete - false only for login-mfa.php
* @return string username (e.g. foo@example.com) or CLI or SETUP.PHP
*/
function authentication_get_username()
function authentication_get_username(bool $requireMfaComplete = true)
{
if (defined('POSTFIXADMIN_CLI')) {
return 'CLI';
@@ -54,6 +43,16 @@ function authentication_get_username()
header("Location: login.php");
exit(0);
}
/**
* when an mfa user logs in (username+password) but haven't yet done the MFA code, $_SESSION['sessid']['username'] will be populated
* but the user hasn't finished authentication, so we should not treat them as having logged in.
*/
if ($requireMfaComplete && authentication_mfa_incomplete()) {
header("Location: login-mfa.php");
exit(0);
}
return $_SESSION['sessid']['username'];
}
+1
View File
@@ -499,6 +499,7 @@ $PALANG['pTOTP_welcome'] = 'Setup your Time-based One-time Password'; # XXX
$PALANG['pUsersMain_totp'] = 'Setup your Time-based One-time Password'; # XXX
$PALANG['pTOTP_secret'] = 'TOTP secret'; # XXX
$PALANG['pTOTP_code'] = 'TOTP code'; # XXX
$PALANG['pTOTP_code_only'] = 'Enter the 6 digit code from your authenticator app'; # XXX
$PALANG['pTOTP_secret_result_error'] = 'Could not change TOTP secret'; # XXX
$PALANG['change_TOTP'] = 'Change TOTP settings'; # XXX
$PALANG['pTOTP_code_text'] = 'Scan the above image and enter the current code shown, in order to enable TOTP auth for your account.'; # XXX
+1
View File
@@ -498,6 +498,7 @@ $PALANG['pTOTP_welcome'] = 'Configuració de la contrasenya d\'una sola vegada b
$PALANG['pUsersMain_totp'] = 'Configuració de la contrasenya d\'una sola vegada basada en el temps';
$PALANG['pTOTP_secret'] = 'TOTP secret';
$PALANG['pTOTP_code'] = 'Codi TOTP';
$PALANG['pTOTP_code_only'] = 'Enter the 6 digit code from your authenticator app'; # XXX
$PALANG['pTOTP_secret_result_error'] = 'TOTP secret';
$PALANG['change_TOTP'] = 'Canviar configuració TOTP';
$PALANG['pTOTP_code_text'] = 'Scan the above image and enter the current code shown, in order to enable TOTP auth for your account.'; # XXX
+1
View File
@@ -499,6 +499,7 @@ $PALANG['pTOTP_welcome'] = '设置基于时间的一次性密码';
$PALANG['pUsersMain_totp'] = '设置基于时间的一次性密码';
$PALANG['pTOTP_secret'] = '附 件';
$PALANG['pTOTP_code'] = 'TP代码';
$PALANG['pTOTP_code_only'] = 'Enter the 6 digit code from your authenticator app'; # XXX
$PALANG['pTOTP_secret_result_error'] = '不能改变秘密做法';
$PALANG['change_TOTP'] = 'A. 变化情况';
$PALANG['pTOTP_code_text'] = 'Scan the above image and enter the current code shown, in order to enable TOTP auth for your account.'; # XXX
+1
View File
@@ -514,6 +514,7 @@ $PALANG['pTOTP_welcome'] = 'Nastavení hesla na bázi času';
$PALANG['pUsersMain_totp'] = 'Nastavení hesla na bázi času';
$PALANG['pTOTP_secret'] = 'TOTP tajemství';
$PALANG['pTOTP_code'] = 'TOTP kód';
$PALANG['pTOTP_code_only'] = 'Enter the 6 digit code from your authenticator app'; # XXX
$PALANG['pTOTP_secret_result_error'] = 'Nelze změnit tajemství TOTP';
$PALANG['change_TOTP'] = 'Změna nastavení TOTP';
$PALANG['pTOTP_code_text'] = 'Scan the above image and enter the current code shown, in order to enable TOTP auth for your account.'; # XXX
+1
View File
@@ -515,6 +515,7 @@ $PALANG['pTOTP_welcome'] = 'Opsætning af din Time-baseret engangsadgangskode';
$PALANG['pUsersMain_totp'] = 'Opsætning af din Time-baseret engangsadgangskode';
$PALANG['pTOTP_secret'] = 'TOTP hemmelighed';
$PALANG['pTOTP_code'] = 'TOTP kode';
$PALANG['pTOTP_code_only'] = 'Enter the 6 digit code from your authenticator app'; # XXX
$PALANG['pTOTP_secret_result_error'] = 'Kan ikke ændre TOTP hemmelighed';
$PALANG['change_TOTP'] = 'Ændre indstillingerne for TOTP';
$PALANG['pTOTP_code_text'] = 'Scan the above image and enter the current code shown, in order to enable TOTP auth for your account.'; # XXX
+1
View File
@@ -511,6 +511,7 @@ $PALANG['pTOTP_welcome'] = 'Richten Sie Ihr zeitbasiertes Einmal-Passwort ein';
$PALANG['pUsersMain_totp'] = 'Richten Sie Ihr zeitbasiertes Einmal-Passwort ein';
$PALANG['pTOTP_secret'] = 'TOTP Geheimnis';
$PALANG['pTOTP_code'] = 'TOTP-Code';
$PALANG['pTOTP_code_only'] = 'Enter the 6 digit code from your authenticator app'; # XXX
$PALANG['pTOTP_secret_result_error'] = 'konnte nicht ändern TOTP Geheimnis';
$PALANG['change_TOTP'] = 'TOTP-Einstellungen ändern';
$PALANG['pTOTP_code_text'] = 'Scan the above image and enter the current code shown, in order to enable TOTP auth for your account.'; # XXX
+1
View File
@@ -225,6 +225,7 @@ $PALANG['pTOTP_welcome'] = 'Setup your Time-based One-time Password';
$PALANG['pUsersMain_totp'] = 'Setup your Time-based One-time Password';
$PALANG['pTOTP_secret'] = 'TOTP secret';
$PALANG['pTOTP_code'] = 'TOTP code (empty to disable)';
$PALANG['pTOTP_code_only'] = 'Enter the 6 digit code from your authenticator app';
$PALANG['pTOTP_secret_result_error'] = 'Could not change TOTP secret';
$PALANG['change_TOTP'] = 'Change TOTP settings';
$PALANG['pTOTP_code_text'] = 'Scan the above image and enter the current code shown, in order to enable TOTP auth for your account.';
+1
View File
@@ -500,6 +500,7 @@ $PALANG['pTOTP_welcome'] = 'Configura tu contraseña de una sola vez basada en e
$PALANG['pUsersMain_totp'] = 'Configura tu contraseña de una sola vez basada en el tiempo';
$PALANG['pTOTP_secret'] = 'Secreto TOTP';
$PALANG['pTOTP_code'] = 'Código TOTP';
$PALANG['pTOTP_code_only'] = 'Enter the 6 digit code from your authenticator app'; # XXX
$PALANG['pTOTP_secret_result_error'] = 'No podría cambiar el secreto de TOTP';
$PALANG['change_TOTP'] = 'Cambiar la configuración TOTP';
$PALANG['pTOTP_code_text'] = 'Escanee la imagen anterior e introduzca el código actual para activar la autenticación TOTP en su cuenta.';
+1
View File
@@ -503,6 +503,7 @@ $PALANG['pTOTP_welcome'] = 'Setup your Time-based One-time Password'; # XXX
$PALANG['pUsersMain_totp'] = 'Setup your Time-based One-time Password'; # XXX
$PALANG['pTOTP_secret'] = 'TOTP secret'; # XXX
$PALANG['pTOTP_code'] = 'TOTP code'; # XXX
$PALANG['pTOTP_code_only'] = 'Enter the 6 digit code from your authenticator app'; # XXX
$PALANG['pTOTP_secret_result_error'] = 'Could not change TOTP secret'; # XXX
$PALANG['change_TOTP'] = 'Change TOTP settings'; # XXX
$PALANG['pTOTP_code_text'] = 'Scan the above image and enter the current code shown, in order to enable TOTP auth for your account.'; # XXX
+1
View File
@@ -498,6 +498,7 @@ $PALANG['pTOTP_welcome'] = 'Setup your Time-based One-time Password'; # XXX
$PALANG['pUsersMain_totp'] = 'Setup your Time-based One-time Password'; # XXX
$PALANG['pTOTP_secret'] = 'TOTP secret'; # XXX
$PALANG['pTOTP_code'] = 'TOTP code'; # XXX
$PALANG['pTOTP_code_only'] = 'Enter the 6 digit code from your authenticator app'; # XXX
$PALANG['pTOTP_secret_result_error'] = 'Could not change TOTP secret'; # XXX
$PALANG['change_TOTP'] = 'Change TOTP settings'; # XXX
$PALANG['pTOTP_code_text'] = 'Scan the above image and enter the current code shown, in order to enable TOTP auth for your account.'; # XXX
+1
View File
@@ -499,6 +499,7 @@ $PALANG['pTOTP_welcome'] = 'Aseta aikapohjainen One-time Password';
$PALANG['pUsersMain_totp'] = 'Aseta aikapohjainen One-time Password';
$PALANG['pTOTP_secret'] = 'Totp salaisuus';
$PALANG['pTOTP_code'] = 'TOTP-koodi';
$PALANG['pTOTP_code_only'] = 'Enter the 6 digit code from your authenticator app'; # XXX
$PALANG['pTOTP_secret_result_error'] = 'Ei voi muuttaa salaisuutta';
$PALANG['change_TOTP'] = 'Muuta TOTP-asetuksia';
$PALANG['pTOTP_code_text'] = 'Scan the above image and enter the current code shown, in order to enable TOTP auth for your account.'; # XXX
+1
View File
@@ -504,6 +504,7 @@ $PALANG['pTOTP_welcome'] = 'Setup your Time-based One-time Password'; # XXX
$PALANG['pUsersMain_totp'] = 'Setup your Time-based One-time Password'; # XXX
$PALANG['pTOTP_secret'] = 'TOTP secret'; # XXX
$PALANG['pTOTP_code'] = 'TOTP code'; # XXX
$PALANG['pTOTP_code_only'] = 'Enter the 6 digit code from your authenticator app'; # XXX
$PALANG['pTOTP_secret_result_error'] = 'Could not change TOTP secret'; # XXX
$PALANG['change_TOTP'] = 'Change TOTP settings'; # XXX
$PALANG['pTOTP_code_text'] = 'Scan the above image and enter the current code shown, in order to enable TOTP auth for your account.'; # XXX
+1
View File
@@ -503,6 +503,7 @@ $PALANG['pTOTP_welcome'] = 'Configuration de votre mot de passe à temps unique'
$PALANG['pUsersMain_totp'] = 'Configuration de votre mot de passe à temps unique';
$PALANG['pTOTP_secret'] = 'TOTP secret';
$PALANG['pTOTP_code'] = 'Code TOTP';
$PALANG['pTOTP_code_only'] = 'Enter the 6 digit code from your authenticator app'; # XXX
$PALANG['pTOTP_secret_result_error'] = 'Ne peut pas changer de secret TOTP';
$PALANG['change_TOTP'] = 'Modifier les paramètres TOTP';
$PALANG['pTOTP_code_text'] = 'Scan the above image and enter the current code shown, in order to enable TOTP auth for your account.'; # XXX
+1
View File
@@ -499,6 +499,7 @@ $PALANG['pTOTP_welcome'] = 'Setup your Time-based One-time Password'; # XXX
$PALANG['pUsersMain_totp'] = 'Setup your Time-based One-time Password'; # XXX
$PALANG['pTOTP_secret'] = 'TOTP secret'; # XXX
$PALANG['pTOTP_code'] = 'TOTP code'; # XXX
$PALANG['pTOTP_code_only'] = 'Enter the 6 digit code from your authenticator app'; # XXX
$PALANG['pTOTP_secret_result_error'] = 'Could not change TOTP secret'; # XXX
$PALANG['change_TOTP'] = 'Change TOTP settings'; # XXX
$PALANG['pTOTP_code_text'] = 'Scan the above image and enter the current code shown, in order to enable TOTP auth for your account.'; # XXX
+1
View File
@@ -498,6 +498,7 @@ $PALANG['pTOTP_welcome'] = 'Setup your Time-based One-time Password'; # XXX
$PALANG['pUsersMain_totp'] = 'Setup your Time-based One-time Password'; # XXX
$PALANG['pTOTP_secret'] = 'TOTP secret'; # XXX
$PALANG['pTOTP_code'] = 'TOTP code'; # XXX
$PALANG['pTOTP_code_only'] = 'Enter the 6 digit code from your authenticator app'; # XXX
$PALANG['pTOTP_secret_result_error'] = 'Could not change TOTP secret'; # XXX
$PALANG['change_TOTP'] = 'Change TOTP settings'; # XXX
$PALANG['pTOTP_code_text'] = 'Scan the above image and enter the current code shown, in order to enable TOTP auth for your account.'; # XXX
+1
View File
@@ -512,6 +512,7 @@ $PALANG['pTOTP_welcome'] = 'Állítsa be az időalapú egyszeri jelszót';
$PALANG['pUsersMain_totp'] = 'Állítsa be az időalapú egyszeri jelszót';
$PALANG['pTOTP_secret'] = 'TOTP titkos';
$PALANG['pTOTP_code'] = 'TOTP kód';
$PALANG['pTOTP_code_only'] = 'Enter the 6 digit code from your authenticator app'; # XXX
$PALANG['pTOTP_secret_result_error'] = 'Nem lehet megváltoztatni a TOTP titkát';
$PALANG['change_TOTP'] = 'A TOTP beállítások módosítása';
$PALANG['pTOTP_code_text'] = 'Scan the above image and enter the current code shown, in order to enable TOTP auth for your account.'; # XXX
+1
View File
@@ -499,6 +499,7 @@ $PALANG['pTOTP_welcome'] = 'Setup your Time-based One-time Password'; # XXX
$PALANG['pUsersMain_totp'] = 'Setup your Time-based One-time Password'; # XXX
$PALANG['pTOTP_secret'] = 'TOTP secret'; # XXX
$PALANG['pTOTP_code'] = 'TOTP code'; # XXX
$PALANG['pTOTP_code_only'] = 'Enter the 6 digit code from your authenticator app'; # XXX
$PALANG['pTOTP_secret_result_error'] = 'Could not change TOTP secret'; # XXX
$PALANG['change_TOTP'] = 'Change TOTP settings'; # XXX
$PALANG['pTOTP_code_text'] = 'Scan the above image and enter the current code shown, in order to enable TOTP auth for your account.'; # XXX
+1
View File
@@ -500,6 +500,7 @@ $PALANG['pTOTP_welcome'] = 'Impostare la password di una volta basata sul tempo'
$PALANG['pUsersMain_totp'] = 'Impostare la password di una volta basata sul tempo';
$PALANG['pTOTP_secret'] = 'TOTP segreto';
$PALANG['pTOTP_code'] = 'Codice TOTP';
$PALANG['pTOTP_code_only'] = 'Enter the 6 digit code from your authenticator app'; # XXX
$PALANG['pTOTP_secret_result_error'] = 'Non potrebbe cambiare il segreto TOTP';
$PALANG['change_TOTP'] = 'Modifica delle impostazioni TOTP';
$PALANG['pTOTP_code_text'] = 'Scan the above image and enter the current code shown, in order to enable TOTP auth for your account.'; # XXX
+1
View File
@@ -510,6 +510,7 @@ $PALANG['pTOTP_welcome'] = 'タイムベースワンタイムパスワードの
$PALANG['pUsersMain_totp'] = 'タイムベースワンタイムパスワードの設定';
$PALANG['pTOTP_secret'] = 'TOTPシークレット';
$PALANG['pTOTP_code'] = 'TOTPコード';
$PALANG['pTOTP_code_only'] = 'Enter the 6 digit code from your authenticator app'; # XXX
$PALANG['pTOTP_secret_result_error'] = 'TOTPの秘密を変更できません';
$PALANG['change_TOTP'] = 'TOTP設定の変更';
$PALANG['pTOTP_code_text'] = 'Scan the above image and enter the current code shown, in order to enable TOTP auth for your account.'; # XXX
+1
View File
@@ -225,6 +225,7 @@ $PALANG['pTOTP_welcome'] = '시간 기반 일회용 비밀번호(TOTP) 설정';
$PALANG['pUsersMain_totp'] = '시간 기반 일회용 비밀번호(TOTP) 설정';
$PALANG['pTOTP_secret'] = 'TOTP 시크릿';
$PALANG['pTOTP_code'] = 'TOTP 코드 (비활성화하려면 비워두세요)';
$PALANG['pTOTP_code_only'] = 'Enter the 6 digit code from your authenticator app'; # XXX
$PALANG['pTOTP_secret_result_error'] = 'TOTP 시크릿을 변경할 수 없습니다';
$PALANG['change_TOTP'] = 'TOTP 설정 변경';
$PALANG['pTOTP_code_text'] = '위 이미지를 스캔하고 표시되는 현재 코드를 입력하여 계정에 TOTP 인증을 활성화하세요.';
+1
View File
@@ -505,6 +505,7 @@ $PALANG['pTOTP_welcome'] = 'Setup your Time-based One-time Password'; # XXX
$PALANG['pUsersMain_totp'] = 'Setup your Time-based One-time Password'; # XXX
$PALANG['pTOTP_secret'] = 'TOTP secret'; # XXX
$PALANG['pTOTP_code'] = 'TOTP code'; # XXX
$PALANG['pTOTP_code_only'] = 'Enter the 6 digit code from your authenticator app'; # XXX
$PALANG['pTOTP_secret_result_error'] = 'Could not change TOTP secret'; # XXX
$PALANG['change_TOTP'] = 'Change TOTP settings'; # XXX
$PALANG['pTOTP_code_text'] = 'Scan the above image and enter the current code shown, in order to enable TOTP auth for your account.'; # XXX
+1
View File
@@ -500,6 +500,7 @@ $PALANG['pTOTP_welcome'] = 'Setup your Time-based One-time Password'; # XXX
$PALANG['pUsersMain_totp'] = 'Setup your Time-based One-time Password'; # XXX
$PALANG['pTOTP_secret'] = 'TOTP secret'; # XXX
$PALANG['pTOTP_code'] = 'TOTP code'; # XXX
$PALANG['pTOTP_code_only'] = 'Enter the 6 digit code from your authenticator app'; # XXX
$PALANG['pTOTP_secret_result_error'] = 'Could not change TOTP secret'; # XXX
$PALANG['change_TOTP'] = 'Change TOTP settings'; # XXX
$PALANG['pTOTP_code_text'] = 'Scan the above image and enter the current code shown, in order to enable TOTP auth for your account.'; # XXX
+1
View File
@@ -500,6 +500,7 @@ $PALANG['pTOTP_welcome'] = 'Setup your Time-based One-time Password'; # XXX
$PALANG['pUsersMain_totp'] = 'Setup your Time-based One-time Password'; # XXX
$PALANG['pTOTP_secret'] = 'TOTP secret'; # XXX
$PALANG['pTOTP_code'] = 'TOTP code'; # XXX
$PALANG['pTOTP_code_only'] = 'Enter the 6 digit code from your authenticator app'; # XXX
$PALANG['pTOTP_secret_result_error'] = 'Could not change TOTP secret'; # XXX
$PALANG['change_TOTP'] = 'Change TOTP settings'; # XXX
$PALANG['pTOTP_code_text'] = 'Scan the above image and enter the current code shown, in order to enable TOTP auth for your account.'; # XXX
+1
View File
@@ -502,6 +502,7 @@ $PALANG['pTOTP_welcome'] = 'Zet je Time-based One-time Password';
$PALANG['pUsersMain_totp'] = 'Zet je Time-based One-time Password';
$PALANG['pTOTP_secret'] = 'ToTP geheim';
$PALANG['pTOTP_code'] = 'ToTP';
$PALANG['pTOTP_code_only'] = 'Enter the 6 digit code from your authenticator app'; # XXX
$PALANG['pTOTP_secret_result_error'] = 'Kon ToTP geheim niet veranderen';
$PALANG['change_TOTP'] = 'Verandering ToTP setting';
$PALANG['pTOTP_code_text'] = 'Scan the above image and enter the current code shown, in order to enable TOTP auth for your account.'; # XXX
+1
View File
@@ -499,6 +499,7 @@ $PALANG['pTOTP_welcome'] = 'Setup your Time-based One-time Password'; # XXX
$PALANG['pUsersMain_totp'] = 'Setup your Time-based One-time Password'; # XXX
$PALANG['pTOTP_secret'] = 'TOTP secret'; # XXX
$PALANG['pTOTP_code'] = 'TOTP code'; # XXX
$PALANG['pTOTP_code_only'] = 'Enter the 6 digit code from your authenticator app'; # XXX
$PALANG['pTOTP_secret_result_error'] = 'Could not change TOTP secret'; # XXX
$PALANG['change_TOTP'] = 'Change TOTP settings'; # XXX
$PALANG['pTOTP_code_text'] = 'Scan the above image and enter the current code shown, in order to enable TOTP auth for your account.'; # XXX
+1
View File
@@ -505,6 +505,7 @@ $PALANG['pTOTP_welcome'] = 'Twoja wersja Onetime Password';
$PALANG['pUsersMain_totp'] = 'Twoja wersja Onetime Password';
$PALANG['pTOTP_secret'] = 'TOTP sekret';
$PALANG['pTOTP_code'] = 'kod TOTP';
$PALANG['pTOTP_code_only'] = 'Enter the 6 digit code from your authenticator app'; # XXX
$PALANG['pTOTP_secret_result_error'] = 'Could not change secret (ang.).';
$PALANG['change_TOTP'] = 'Zmiana TOTP';
$PALANG['pTOTP_code_text'] = 'Scan the above image and enter the current code shown, in order to enable TOTP auth for your account.'; # XXX
+1
View File
@@ -512,6 +512,7 @@ $PALANG['pTOTP_welcome'] = 'Configure sua senha de uma só vez baseada em tempo'
$PALANG['pUsersMain_totp'] = 'Configure sua senha de uma só vez baseada em tempo';
$PALANG['pTOTP_secret'] = 'TOTP segredo';
$PALANG['pTOTP_code'] = 'Código TOTP';
$PALANG['pTOTP_code_only'] = 'Enter the 6 digit code from your authenticator app'; # XXX
$PALANG['pTOTP_secret_result_error'] = 'Não poderia mudar segredo TOTP';
$PALANG['change_TOTP'] = 'Alterar configurações do TOTP';
$PALANG['pTOTP_code_text'] = 'Scan the above image and enter the current code shown, in order to enable TOTP auth for your account.'; # XXX
+1
View File
@@ -512,6 +512,7 @@ $PALANG['pTOTP_welcome'] = 'Configure sua senha de uma só vez baseada em tempo'
$PALANG['pUsersMain_totp'] = 'Configure sua senha de uma só vez baseada em tempo';
$PALANG['pTOTP_secret'] = 'TOTP segredo';
$PALANG['pTOTP_code'] = 'Código TOTP';
$PALANG['pTOTP_code_only'] = 'Enter the 6 digit code from your authenticator app'; # XXX
$PALANG['pTOTP_secret_result_error'] = 'Não poderia mudar segredo TOTP';
$PALANG['change_TOTP'] = 'Alterar configurações do TOTP';
$PALANG['pTOTP_code_text'] = 'Scan the above image and enter the current code shown, in order to enable TOTP auth for your account.'; # XXX
+1
View File
@@ -511,6 +511,7 @@ $PALANG['pTOTP_welcome'] = 'Setup your Time-based One-time Password'; # XXX
$PALANG['pUsersMain_totp'] = 'Setup your Time-based One-time Password'; # XXX
$PALANG['pTOTP_secret'] = 'TOTP secret'; # XXX
$PALANG['pTOTP_code'] = 'TOTP code'; # XXX
$PALANG['pTOTP_code_only'] = 'Enter the 6 digit code from your authenticator app'; # XXX
$PALANG['pTOTP_secret_result_error'] = 'Could not change TOTP secret'; # XXX
$PALANG['change_TOTP'] = 'Change TOTP settings'; # XXX
$PALANG['pTOTP_code_text'] = 'Scan the above image and enter the current code shown, in order to enable TOTP auth for your account.'; # XXX
+1
View File
@@ -513,6 +513,7 @@ $PALANG['pTOTP_welcome'] = 'Настройка одноразового паро
$PALANG['pUsersMain_totp'] = 'Настройка одноразового пароля на основе времени';
$PALANG['pTOTP_secret'] = 'Секрет TOTP';
$PALANG['pTOTP_code'] = 'Код TOTP';
$PALANG['pTOTP_code_only'] = 'Enter the 6 digit code from your authenticator app'; # XXX
$PALANG['pTOTP_secret_result_error'] = 'Невозможно изменить секрет TOTP';
$PALANG['change_TOTP'] = 'Изменение параметров TOTP';
$PALANG['pTOTP_code_text'] = 'Scan the above image and enter the current code shown, in order to enable TOTP auth for your account.'; # XXX
+1
View File
@@ -500,6 +500,7 @@ $PALANG['pTOTP_welcome'] = 'Nastaviť svoje časové heslo';
$PALANG['pUsersMain_totp'] = 'Nastaviť svoje časové heslo';
$PALANG['pTOTP_secret'] = 'TOTP tajomstvo';
$PALANG['pTOTP_code'] = 'Kód TOTP';
$PALANG['pTOTP_code_only'] = 'Enter the 6 digit code from your authenticator app'; # XXX
$PALANG['pTOTP_secret_result_error'] = 'Nemožno zmeniť TOTP tajomstvo';
$PALANG['change_TOTP'] = 'Zmena nastavení TOTP';
$PALANG['pTOTP_code_text'] = 'Scan the above image and enter the current code shown, in order to enable TOTP auth for your account.'; # XXX
+1
View File
@@ -499,6 +499,7 @@ $PALANG['pTOTP_welcome'] = 'Setup your Time-based One-time Password'; # XXX
$PALANG['pUsersMain_totp'] = 'Setup your Time-based One-time Password'; # XXX
$PALANG['pTOTP_secret'] = 'TOTP secret'; # XXX
$PALANG['pTOTP_code'] = 'TOTP code'; # XXX
$PALANG['pTOTP_code_only'] = 'Enter the 6 digit code from your authenticator app'; # XXX
$PALANG['pTOTP_secret_result_error'] = 'Could not change TOTP secret'; # XXX
$PALANG['change_TOTP'] = 'Change TOTP settings'; # XXX
$PALANG['pTOTP_code_text'] = 'Scan the above image and enter the current code shown, in order to enable TOTP auth for your account.'; # XXX
+1
View File
@@ -512,6 +512,7 @@ $PALANG['pTOTP_welcome'] = 'Ställ in ditt tidsbaserade engångslösenord';
$PALANG['pUsersMain_totp'] = 'Ställ in ditt tidsbaserade engångslösenord';
$PALANG['pTOTP_secret'] = 'TOTP hemlighet';
$PALANG['pTOTP_code'] = 'TOTP-kod';
$PALANG['pTOTP_code_only'] = 'Enter the 6 digit code from your authenticator app'; # XXX
$PALANG['pTOTP_secret_result_error'] = 'Kunde inte ändra TOTP hemlighet';
$PALANG['change_TOTP'] = 'Ändra TOTP-inställningar';
$PALANG['pTOTP_code_text'] = 'Scan the above image and enter the current code shown, in order to enable TOTP auth for your account.'; # XXX
+1
View File
@@ -499,6 +499,7 @@ $PALANG['pTOTP_welcome'] = 'Zaman tabanlı One-time Şifrenizi Değiştirin';
$PALANG['pUsersMain_totp'] = 'Zaman tabanlı One-time Şifrenizi Değiştirin';
$PALANG['pTOTP_secret'] = 'TOTP sırrı';
$PALANG['pTOTP_code'] = 'TOTP kodu';
$PALANG['pTOTP_code_only'] = 'Enter the 6 digit code from your authenticator app'; # XXX
$PALANG['pTOTP_secret_result_error'] = 'TOTP sırrını değiştiremez';
$PALANG['change_TOTP'] = 'TOTP ayarlarını değiştirin';
$PALANG['pTOTP_code_text'] = 'Hesabınız için TOTP kimlik doğrulamasını etkinleştirmek üzere yukarıdaki resmi tarayın ve görüntülenen güncel kodu girin.';
+1
View File
@@ -501,6 +501,7 @@ $PALANG['pTOTP_welcome'] = '设置基于时间的一次性密码';
$PALANG['pUsersMain_totp'] = '设置基于时间的一次性密码';
$PALANG['pTOTP_secret'] = '附 件';
$PALANG['pTOTP_code'] = 'TP代码';
$PALANG['pTOTP_code_only'] = 'Enter the 6 digit code from your authenticator app'; # XXX
$PALANG['pTOTP_secret_result_error'] = '不能改变秘密做法';
$PALANG['change_TOTP'] = 'A. 变化情况';
$PALANG['pTOTP_code_text'] = 'Scan the above image and enter the current code shown, in order to enable TOTP auth for your account.'; # XXX
+1
View File
@@ -514,6 +514,7 @@ $PALANG['pTOTP_welcome'] = 'Налаштування пароля на осно
$PALANG['pUsersMain_totp'] = 'Налаштування пароля на основі часу';
$PALANG['pTOTP_secret'] = 'Секрет';
$PALANG['pTOTP_code'] = 'Поштовий індекс';
$PALANG['pTOTP_code_only'] = 'Enter the 6 digit code from your authenticator app'; # XXX
$PALANG['pTOTP_secret_result_error'] = 'Не можна змінити секрет TOTP';
$PALANG['change_TOTP'] = 'Зміна налаштувань TOTP';
$PALANG['pTOTP_code_text'] = 'Scan the above image and enter the current code shown, in order to enable TOTP auth for your account.'; # XXX
+6 -25
View File
@@ -1,31 +1,12 @@
<?php
/**
* Postfix Admin
*
* LICENSE
* This source file is subject to the GPL license that is bundled with
* this package in the file LICENSE.TXT.
* @license GPLv2 or later. This source file is subject to the GPL license that is bundled with this package in the file LICENSE.TXT.
*
* Further details on the project are available at https://github.com/postfixadmin/postfixadmin
*
* @version $Id$
* @license GNU GPL v2 or later.
*
* File: login-totp.php
* Authenticates a user, and populates their $_SESSION as appropriate.
* Template File: login.tpl
*
* Template Variables:
*
* none
*
* Form POST \ GET Variables:
*
* fUsername
* fPassword
* token
* lang
* If a user has MFA enabled, after they've authenticated their username/password at /users/login.php they should be redirected here.
* We therefore need to get the MFA/TOTP code and validate it.
*/
require_once('common.php');
@@ -61,8 +42,8 @@ if ($_SERVER['REQUEST_METHOD'] == "POST") {
$fTotp = safepost('fTOTP_code');
$h = new AdminHandler();
if (authentication_mfa_incomplete() && $totppf->checkUserTOTP(authentication_get_username(), $fTotp)) {
init_session(authentication_get_username(), true, true);
if (authentication_mfa_incomplete() && $totppf->checkUserTOTP(authentication_get_username(false), $fTotp)) {
init_session(authentication_get_username(false), true, true);
// get superadmin status and store in session
$h->init(authentication_get_username());
@@ -72,7 +53,7 @@ if ($_SERVER['REQUEST_METHOD'] == "POST") {
header("Location: main.php");
exit(0);
} else {
error_log("PostfixAdmin admin second factor login failed (username: " . authentication_get_username() . ", ip_address: {$_SERVER['REMOTE_ADDR']})");
error_log("PostfixAdmin admin second factor login failed (username: " . authentication_get_username(false). ", ip_address: {$_SERVER['REMOTE_ADDR']})");
$error = $PALANG['pTotp_failed'];
flash_error($PALANG['pTotp_failed']);
}
+6 -26
View File
@@ -1,33 +1,13 @@
<?php
/**
* Postfix Admin
*
* LICENSE
* This source file is subject to the GPL license that is bundled with
* this package in the file LICENSE.TXT.
* @license GPLv2 This source file is subject to the GPL license that is bundled with this package in the file LICENSE.TXT.
*
* Further details on the project are available at https://github.com/postfixadmin/postfixadmin
*
* @version $Id$
* @license GNU GPL v2 or later.
*
* File: login-totp.php
* Authenticates a user, and populates their $_SESSION as appropriate.
* Template File: login.tpl
*
* Template Variables:
*
* none
*
* Form POST \ GET Variables:
*
* fUsername
* fPassword
* token
* lang
* If a user has MFA enabled, after they've authenticated their username/password at /users/login.php they should be redirected here.
* We therefore need to get the MFA/TOTP code and validate it.
*/
require_once('../common.php');
if (authentication_has_role("user")) {
@@ -54,12 +34,12 @@ if ($_SERVER['REQUEST_METHOD'] == "POST") {
$totppf = new TotpPf('mailbox', new Login('mailbox'));
$fTotp = safepost('fTOTP_code');
if (authentication_mfa_incomplete() && $totppf->checkUserTOTP(authentication_get_username(), $fTotp)) {
init_session(authentication_get_username(), false, true);
if (authentication_mfa_incomplete() && $totppf->checkUserTOTP(authentication_get_username(false), $fTotp)) {
init_session(authentication_get_username(false), false, true);
header("Location: main.php");
exit(0);
} else { # $h->login failed
error_log("PostfixAdmin admin second factor login failed (username: " . authentication_get_username() . ", ip_address: {$_SERVER['REMOTE_ADDR']})");
error_log("PostfixAdmin admin second factor login failed (username: " . authentication_get_username(false) . ", ip_address: {$_SERVER['REMOTE_ADDR']})");
flash_error($PALANG['pTotp_failed']);
}
}
+1 -1
View File
@@ -6,7 +6,7 @@
{CSRF_Token}
<div class="mb-3 {if $pTOPT_code_text}is-invalid{/if}">
<label class="col-md-4 col-sm-4" for="fTOTP_code">{$PALANG.pTOTP_code}:</label>
<label class="col-md-4 col-sm-4" for="fTOTP_code">{$PALANG.pTOTP_code_only}:</label>
<div class="col-md-6 col-sm-8"><input id="fTOTP_code" class="form-control"
type="text" name="fTOTP_code" size="6"
inputmode="numeric" autocomplete="one-time-code" autofocus/></div>
+23 -23
View File
@@ -1,5 +1,28 @@
<form name="password" method="post" action="" class="form-horizontal">
{if $show_form == 'hidden'}
<div id="showform" class="card">
<div class="card-footer">
<div class="btn-toolbar" role="toolbar">
<div class="float-start">
<h3>{$PALANG.TOTP_already_configured}</h3>
</div>
<div class="float-end">
<a href="#" class="btn ml btn-lg btn-primary" id="showbutton">{$PALANG.show}</a>
</div>
</div>
</div>
</div>
<script>
document.getElementById("showbutton").addEventListener("click", function (e) {
showform()
});
function showform() {
document.getElementById("showform").style.visibility = "hidden";
document.getElementById("edit_form").style.visibility = "visible";
}
</script>
{/if}
<div id="edit_form" class="card" style="visibility:{$show_form}">
<div class="card-header"><h4>{$PALANG.pTOTP_welcome}</h4></div>
<div class="card-body enable-asterisk">
@@ -49,28 +72,5 @@
</div>
</div>
</div>
{if $show_form == 'hidden'}
<div id="showform" class="card">
<div class="card-footer">
<div class="btn-toolbar" role="toolbar">
<div class="float-start">
<h3>{$PALANG.TOTP_already_configured}</h3>
</div>
<div class="float-end">
<a href="#" class="btn ml btn-lg btn-primary" id="showbutton">{$PALANG.show}</a>
</div>
</div>
</div>
</div>
<script>
document.getElementById("showbutton").addEventListener("click", function (e) {
showform()
});
function showform() {
document.getElementById("showform").style.visibility = "hidden";
document.getElementById("edit_form").style.visibility = "visible";
}
</script>
{/if}
</form>