From afdeea6927c4c4a2307f34dd3d09e080a6b91d7c Mon Sep 17 00:00:00 2001 From: grimpirate Date: Mon, 28 Oct 2024 02:20:07 -0400 Subject: [PATCH 1/2] Session::checkAction refactor --- src/Authentication/Authenticators/Session.php | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) 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; } From fac05a52bf4b09d6947cfb395ca23df5077eca24 Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Sat, 2 Nov 2024 19:53:06 +0330 Subject: [PATCH 2/2] fix: code style fix --- src/Authentication/Authenticators/Session.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Authentication/Authenticators/Session.php b/src/Authentication/Authenticators/Session.php index 61b540d40..bd87df430 100644 --- a/src/Authentication/Authenticators/Session.php +++ b/src/Authentication/Authenticators/Session.php @@ -235,7 +235,7 @@ public function getAction(): ?ActionInterface */ public function checkAction(UserIdentity $identity, string $token): bool { - if(!$this->loggedIn() && !$this->isPending()) { + if (! $this->loggedIn() && ! $this->isPending()) { throw new LogicException('Cannot get the User.'); }