[WIP] 2fa

This commit is contained in:
slawkens
2025-07-05 08:20:58 +02:00
parent ecc9bd4042
commit e435062025
5 changed files with 41 additions and 41 deletions

View File

@@ -50,7 +50,7 @@ if (ACTION == 'email-code') {
$twig->display('error_box.html.twig', ['errors' => $errors]);
}
$twig->display('account.2fa.email-code.login.html.twig');
$twig->display('account.2fa.email.login.html.twig');
}
else if ($step == 'activate') {
if (!$twoFactorAuth->hasRecentEmailCode(15 * 60)) {
@@ -116,6 +116,6 @@ if (ACTION == 'email-code') {
$twig->display('error_box.html.twig', ['errors' => $errors]);
}
$twig->display('account.2fa.email-code.deactivate.html.twig', ['wrongCode' => count($errors) > 0]);
$twig->display('account.2fa.email.deactivate.html.twig', ['wrongCode' => count($errors) > 0]);
}
}

View File

@@ -51,6 +51,11 @@ if(!empty($login_account) && !empty($login_password))
if (setting('core.account_mail_verify') && (int)$account_logged->getCustomField('email_verified') !== 1) {
$errors[] = 'Your account is not verified. Please verify your email address. If the message is not coming check the SPAM folder in your E-Mail client.';
} else {
$twoFactorAuth = TwoFactorAuth::getInstance($account_logged);
if (!$twoFactorAuth->process($login_account, $login_password, $_POST['email-code'] ?? '')) {
return;
}
session_regenerate_id();
setSession('account', $account_logged->getId());
setSession('password', encrypt((USE_ACCOUNT_SALT ? $account_logged->getCustomField('salt') : '') . $login_password));
@@ -58,11 +63,6 @@ if(!empty($login_account) && !empty($login_password))
setSession('remember_me', true);
}
$twoFactorAuth = TwoFactorAuth::getInstance($account_logged);
if (!$twoFactorAuth->process($_POST['email-code'] ?? '')) {
return;
}
$logged = true;
$logged_flags = $account_logged->getWebFlags();