Changeset View
Changeset View
Standalone View
Standalone View
src/applications/auth/controller/PhabricatorAuthLoginController.php
| Show First 20 Lines • Show All 110 Lines • ▼ Show 20 Lines | if ($account->getUserPHID()) { | ||||
| pht( | pht( | ||||
| 'The external account ("%s") you just authenticated with is '. | 'The external account ("%s") you just authenticated with is '. | ||||
| 'not configured to allow registration on this Phabricator '. | 'not configured to allow registration on this Phabricator '. | ||||
| 'install. An administrator may have recently disabled it.', | 'install. An administrator may have recently disabled it.', | ||||
| $provider->getProviderName())); | $provider->getProviderName())); | ||||
| } | } | ||||
| } else { | } else { | ||||
| // If the user already has a linked account of this type, prevent them | // If the user already has a linked account on this provider, prevent | ||||
| // from linking a second account. This can happen if they swap logins | // them from linking a second account. This can happen if they swap | ||||
| // and then refresh the account link. See T6707. We will eventually | // logins and then refresh the account link. | ||||
| // allow this after T2549. | |||||
| // There's no technical reason we can't allow you to link multiple | |||||
| // accounts from a single provider; disallowing this is currently a | |||||
| // product deciison. See T2549. | |||||
| $existing_accounts = id(new PhabricatorExternalAccountQuery()) | $existing_accounts = id(new PhabricatorExternalAccountQuery()) | ||||
| ->setViewer($viewer) | ->setViewer($viewer) | ||||
| ->withUserPHIDs(array($viewer->getPHID())) | ->withUserPHIDs(array($viewer->getPHID())) | ||||
| ->withAccountTypes(array($account->getAccountType())) | ->withProviderConfigPHIDs( | ||||
| array( | |||||
| $provider->getProviderConfigPHID(), | |||||
| )) | |||||
| ->execute(); | ->execute(); | ||||
| if ($existing_accounts) { | if ($existing_accounts) { | ||||
| return $this->renderError( | return $this->renderError( | ||||
| pht( | pht( | ||||
| 'Your Phabricator account is already connected to an external '. | 'Your Phabricator account is already connected to an external '. | ||||
| 'account on this provider ("%s"), but you are currently logged '. | 'account on this provider ("%s"), but you are currently logged '. | ||||
| 'in to the provider with a different account. Log out of the '. | 'in to the provider with a different account. Log out of the '. | ||||
| 'external service, then log back in with the correct account '. | 'external service, then log back in with the correct account '. | ||||
| ▲ Show 20 Lines • Show All 140 Lines • Show Last 20 Lines | |||||