Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Session->checkAction method #1214

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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()) {
datamweb marked this conversation as resolved.
Show resolved Hide resolved
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
Loading