diff --git a/app/controllers/api/account.php b/app/controllers/api/account.php index ddb85e0d1..89ccb1e30 100644 --- a/app/controllers/api/account.php +++ b/app/controllers/api/account.php @@ -1244,7 +1244,7 @@ App::get('/v1/account/sessions/oauth2/:provider/redirect') $identityWithMatchingEmail = $dbForProject->findOne('identities', [ Query::equal('providerEmail', [$email]), - Query::notEqual('userId', $userId), + Query::notEqual('userInternalId', $user->getInternalId()), ]); if (!empty($identityWithMatchingEmail)) { throw new Exception(Exception::USER_ALREADY_EXISTS); @@ -1395,7 +1395,7 @@ App::get('/v1/account/sessions/oauth2/:provider/redirect') $identitiesWithMatchingEmail = $dbForProject->find('identities', [ Query::equal('providerEmail', [$email]), - Query::notEqual('userId', $user->getId()), + Query::notEqual('userInternalId', $user->getInternalId()), ]); if (!empty($identitiesWithMatchingEmail)) { throw new Exception(Exception::GENERAL_BAD_REQUEST); /** Return a generic bad request to prevent exposing existing accounts */ diff --git a/app/controllers/api/teams.php b/app/controllers/api/teams.php index d870f49af..ca26e82d3 100644 --- a/app/controllers/api/teams.php +++ b/app/controllers/api/teams.php @@ -969,7 +969,7 @@ App::patch('/v1/teams/:teamId/memberships/:membershipId/status') $user->setAttributes($dbForProject->getDocument('users', $userId)->getArrayCopy()); // Get user } - if ($membership->getAttribute('userId') !== $user->getId()) { + if ($membership->getAttribute('userInternalId') !== $user->getInternalId()) { throw new Exception(Exception::TEAM_INVITE_MISMATCH, 'Invite does not belong to current user (' . $user->getAttribute('email') . ')'); } diff --git a/app/controllers/api/users.php b/app/controllers/api/users.php index d8dd3cd04..abfcb34a5 100644 --- a/app/controllers/api/users.php +++ b/app/controllers/api/users.php @@ -1206,7 +1206,7 @@ App::patch('/v1/users/:userId/email') // Makes sure this email is not already used in another identity $identityWithMatchingEmail = $dbForProject->findOne('identities', [ Query::equal('providerEmail', [$email]), - Query::notEqual('userId', $user->getId()), + Query::notEqual('userInternalId', $user->getInternalId()), ]); if ($identityWithMatchingEmail !== false && !$identityWithMatchingEmail->isEmpty()) { throw new Exception(Exception::USER_EMAIL_ALREADY_EXISTS);