[WIP] 2fa

* Don't allow per get request to disable 2fa
* Fix google recaptcha issue
* Fix rec key check
* Make input auth code required + autofocus
This commit is contained in:
slawkens
2026-01-31 20:44:26 +01:00
parent 381d5bb884
commit 7471c49793
13 changed files with 86 additions and 75 deletions

View File

@@ -3,8 +3,23 @@ defined('MYAAC') or die('Direct access not allowed!');
require __DIR__ . '/../base.php';
if ($twoFactorAuth->hasRecentEmailCode(1 * 60)) {
$errors = ['Sorry, one email per 15 minutes'];
if ((!setting('core.mail_enabled'))) {
$twig->display('error_box.html.twig', ['errors' => ['Account Two-Factor E-Mail Authentication disabled.']]);
return;
}
if (!$account_logged->isLoaded()) {
error('Account not found!');
return;
}
if ($twoFactorAuth->isActive($twoFactorAuth::TYPE_APP)) {
error('You have to disable the app auth first!');
return;
}
if ($twoFactorAuth->hasRecentEmailCode(30 * 60)) {
$errors = ['Sorry, one email per 30 minutes'];
}
else {
$twoFactorAuth->resendEmailCode();
@@ -14,4 +29,4 @@ if (!empty($errors)) {
$twig->display('error_box.html.twig', ['errors' => $errors]);
}
$twig->display('account/2fa/email/login.html.twig');
$twig->display('account/2fa/email/enable.html.twig');