Use existing method to handle the login
This commit is contained in:
parent
4d3362b24f
commit
3ae70efc14
1 changed files with 13 additions and 19 deletions
|
@ -67,27 +67,21 @@ 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', [
|
|
||||||
'user_id' => $user->id,
|
|
||||||
'token_value' => $token,
|
|
||||||
'expires_at' => CarbonImmutable::now()->addMinutes(5),
|
|
||||||
]);
|
|
||||||
|
|
||||||
return new JsonResponse([
|
|
||||||
'data' => [
|
|
||||||
'complete' => false,
|
|
||||||
'confirmation_token' => $token,
|
|
||||||
],
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->auth->guard()->login($user, true);
|
$request->session()->put('auth_confirmation_token', [
|
||||||
|
'user_id' => $user->id,
|
||||||
|
'token_value' => $token = Str::random(64),
|
||||||
|
'expires_at' => CarbonImmutable::now()->addMinutes(5),
|
||||||
|
]);
|
||||||
|
|
||||||
$request->session()->regenerate();
|
return new JsonResponse([
|
||||||
|
'data' => [
|
||||||
return $this->sendLoginResponse($user, $request);
|
'complete' => false,
|
||||||
|
'confirmation_token' => $token,
|
||||||
|
],
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue