Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
pxpm committed Aug 31, 2023
1 parent 2e912ac commit d2a0f59
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/app/Library/Auth/AuthenticatesUsers.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function login(Request $request)

if ($this->attemptLogin($request)) {
if (config('backpack.base.setup_email_verification_routes', false)) {
$this->verifyUserBeforeLogin($request);
return $this->logoutIfEmailNotVerified($request);
}

return $this->sendLoginResponse($request);
Expand Down Expand Up @@ -205,15 +205,14 @@ protected function guard()
return Auth::guard();
}

private function verifyUserBeforeLogin(Request $request): Response|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
private function logoutIfEmailNotVerified(Request $request): Response|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
{
$user = $this->guard()->user();

// if the user is already verified, do nothing
if ($user->email_verified_at) {
return;
return $this->sendLoginResponse($request);
}

// user is not yet verified, log him out
$this->guard()->logout();

Expand Down

0 comments on commit d2a0f59

Please sign in to comment.