diff --git a/src/Authentication/Authenticators/Session.php b/src/Authentication/Authenticators/Session.php index 4c1b52b1a..61b540d40 100644 --- a/src/Authentication/Authenticators/Session.php +++ b/src/Authentication/Authenticators/Session.php @@ -235,9 +235,7 @@ public function getAction(): ?ActionInterface */ public function checkAction(UserIdentity $identity, string $token): bool { - $user = ($this->loggedIn() || $this->isPending()) ? $this->user : null; - - if ($user === null) { + if(!$this->loggedIn() && !$this->isPending()) { throw new LogicException('Cannot get the User.'); } @@ -246,15 +244,13 @@ public function checkAction(UserIdentity $identity, string $token): bool } // On success - remove the identity - $this->userIdentityModel->deleteIdentitiesByType($user, $identity->type); + $this->userIdentityModel->deleteIdentitiesByType($this->user, $identity->type); // Clean up our session $this->removeSessionUserKey('auth_action'); $this->removeSessionUserKey('auth_action_message'); - $this->user = $user; - - $this->completeLogin($user); + $this->completeLogin($this->user); return true; }