two factor update

This commit is contained in:
Austin 2021-11-28 05:19:21 -05:00
parent fd6924abb3
commit 573d373610
2 changed files with 8 additions and 8 deletions

View File

@ -151,8 +151,9 @@ namespace Alphaland\Users {
$localuser = $GLOBALS['user']->id; $localuser = $GLOBALS['user']->id;
if (!TwoFactor::IsSession2FAUnlocked()) { if (!TwoFactor::IsSession2FAUnlocked()) {
if (TwoFactor::Verify2FACode($localuser, $code)) { if (TwoFactor::Verify2FACode($localuser, $code)) {
TwoFactor::Auth2FAUserSession(); if (TwoFactor::Auth2FAUserSession()) {
return true; return true;
}
} }
} }
return false; return false;

View File

@ -6,14 +6,13 @@ if (TwoFactor::IsSession2FAUnlocked()){
redirect("/"); redirect("/");
} }
if(isset($_POST['submit_2fa'])) if(isset($_POST['submit_2fa'])) {
{ if (TwoFactor::AttemptSession2FAUnlock($_POST['2fa_code'])) {
TwoFactor::AttemptSession2FAUnlock($_POST['2fa_code']); redirect("/");
redirect("/"); }
} }
if(isset($_POST['logout'])) if(isset($_POST['logout'])) {
{
$user->logout(); $user->logout();
redirect("/"); redirect("/");
} }