Fixes 2FA cookie -> user issue

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe 2022-02-15 18:29:23 -08:00
parent 321be4733d
commit f878e0ad66
2 changed files with 2 additions and 2 deletions

View file

@ -363,7 +363,7 @@ class LoginController extends Controller
if (Google2FA::verifyKey($user->two_factor_secret, $secret)) {
$user->two_factor_enrolled = 1;
$user->save();
$request->session()->put('2fa_authed', 'true');
$request->session()->put('2fa_authed', $user->id);
return redirect()->route('home')->with('success', 'You are logged in!');
}

View file

@ -32,7 +32,7 @@ class CheckForTwoFactor
if ($settings = Setting::getSettings()) {
if (Auth::check() && ($settings->two_factor_enabled != '')) {
// This user is already 2fa-authed
if ($request->session()->get('2fa_authed')) {
if ($request->session()->get('2fa_authed')==Auth::user()->id) {
return $next($request);
}