From 17df9187ba2162f640888e43436c4f83720416ed Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Tue, 23 Feb 2021 02:22:35 -0800 Subject: [PATCH] authx - The "already logged in" check should be less sensitive to int-vs-string for user/contact ID --- ext/authx/Civi/Authx/Authenticator.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ext/authx/Civi/Authx/Authenticator.php b/ext/authx/Civi/Authx/Authenticator.php index aa5d0b1379..7025d2072a 100644 --- a/ext/authx/Civi/Authx/Authenticator.php +++ b/ext/authx/Civi/Authx/Authenticator.php @@ -102,9 +102,12 @@ class Authenticator { */ protected function login($contactId, $userId, bool $useSession) { $authxUf = _authx_uf(); + $isSameValue = function($a, $b) { + return !empty($a) && (string) $a === (string) $b; + }; if (\CRM_Core_Session::getLoggedInContactID() || $authxUf->getCurrentUserId()) { - if (\CRM_Core_Session::getLoggedInContactID() === $contactId && $authxUf->getCurrentUserId() === $userId) { + if ($isSameValue(\CRM_Core_Session::getLoggedInContactID(), $contactId) && $isSameValue($authxUf->getCurrentUserId(), $userId)) { return; } else { -- 2.25.1