Skip to content

Commit

Permalink
Session::checkAction refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
grimpirate authored Oct 28, 2024
1 parent 6726646 commit afdeea6
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/Authentication/Authenticators/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.');
}

Expand All @@ -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;
}
Expand Down

0 comments on commit afdeea6

Please sign in to comment.