Use existing method to handle the login

This commit is contained in:
DaneEveritt 2022-05-22 17:26:32 -04:00
parent 4d3362b24f
commit 3ae70efc14
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53

View file

@ -67,12 +67,13 @@ class LoginController extends AbstractLoginController
$this->sendFailedLoginResponse($request, $user); $this->sendFailedLoginResponse($request, $user);
} }
if ($user->use_totp) { if (!$user->use_totp) {
$token = Str::random(64); return $this->sendLoginResponse($user, $request);
}
$request->session()->put('auth_confirmation_token', [ $request->session()->put('auth_confirmation_token', [
'user_id' => $user->id, 'user_id' => $user->id,
'token_value' => $token, 'token_value' => $token = Str::random(64),
'expires_at' => CarbonImmutable::now()->addMinutes(5), 'expires_at' => CarbonImmutable::now()->addMinutes(5),
]); ]);
@ -83,11 +84,4 @@ class LoginController extends AbstractLoginController
], ],
]); ]);
} }
$this->auth->guard()->login($user, true);
$request->session()->regenerate();
return $this->sendLoginResponse($user, $request);
}
} }