Changeset View
Changeset View
Standalone View
Standalone View
src/applications/auth/controller/PhabricatorAuthLoginController.php
| Show First 20 Lines • Show All 62 Lines • ▼ Show 20 Lines | public function processRequest() { | ||||
| } | } | ||||
| if ($response) { | if ($response) { | ||||
| return $response; | return $response; | ||||
| } | } | ||||
| if (!$account) { | if (!$account) { | ||||
| throw new Exception( | throw new Exception( | ||||
| "Auth provider failed to load an account from processLoginRequest()!"); | 'Auth provider failed to load an account from processLoginRequest()!'); | ||||
| } | } | ||||
| if ($account->getUserPHID()) { | if ($account->getUserPHID()) { | ||||
| // The account is already attached to a Phabricator user, so this is | // The account is already attached to a Phabricator user, so this is | ||||
| // either a login or a bad account link request. | // either a login or a bad account link request. | ||||
| if (!$viewer->isLoggedIn()) { | if (!$viewer->isLoggedIn()) { | ||||
| if ($provider->shouldAllowLogin()) { | if ($provider->shouldAllowLogin()) { | ||||
| return $this->processLoginUser($account); | return $this->processLoginUser($account); | ||||
| ▲ Show 20 Lines • Show All 79 Lines • ▼ Show 20 Lines | private function processLinkUser(PhabricatorExternalAccount $account) { | ||||
| return $this->setAccountKeyAndContinue($account, $confirm_uri); | return $this->setAccountKeyAndContinue($account, $confirm_uri); | ||||
| } | } | ||||
| private function setAccountKeyAndContinue( | private function setAccountKeyAndContinue( | ||||
| PhabricatorExternalAccount $account, | PhabricatorExternalAccount $account, | ||||
| $next_uri) { | $next_uri) { | ||||
| if ($account->getUserPHID()) { | if ($account->getUserPHID()) { | ||||
| throw new Exception("Account is already registered or linked."); | throw new Exception('Account is already registered or linked.'); | ||||
| } | } | ||||
| // Regenerate the registration secret key, set it on the external account, | // Regenerate the registration secret key, set it on the external account, | ||||
| // set a cookie on the user's machine, and redirect them to registration. | // set a cookie on the user's machine, and redirect them to registration. | ||||
| // See PhabricatorAuthRegisterController for discussion of the registration | // See PhabricatorAuthRegisterController for discussion of the registration | ||||
| // key. | // key. | ||||
| $registration_key = Filesystem::readRandomCharacters(32); | $registration_key = Filesystem::readRandomCharacters(32); | ||||
| ▲ Show 20 Lines • Show All 77 Lines • Show Last 20 Lines | |||||