Skip to content

Commit

Permalink
authx - The "already logged in" check should be less sensitive to int…
Browse files Browse the repository at this point in the history
…-vs-string for user/contact ID
  • Loading branch information
totten committed Feb 26, 2021
1 parent 234721a commit 385091b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion ext/authx/Civi/Authx/Authenticator.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,12 @@ public function auth($e, $cred, $useSession = FALSE) {
*/
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 {
Expand Down

0 comments on commit 385091b

Please sign in to comment.