Changeset View
Changeset View
Standalone View
Standalone View
src/applications/auth/controller/PhabricatorAuthLoginController.php
Show All 29 Lines | public function handleRequest(AphrontRequest $request) { | ||||
$this->providerKey = $request->getURIData('pkey'); | $this->providerKey = $request->getURIData('pkey'); | ||||
$this->extraURIData = $request->getURIData('extra'); | $this->extraURIData = $request->getURIData('extra'); | ||||
$response = $this->loadProvider(); | $response = $this->loadProvider(); | ||||
if ($response) { | if ($response) { | ||||
return $response; | return $response; | ||||
} | } | ||||
$invite = $this->loadInvite(); | |||||
$provider = $this->provider; | $provider = $this->provider; | ||||
try { | try { | ||||
list($account, $response) = $provider->processLoginRequest($this); | list($account, $response) = $provider->processLoginRequest($this); | ||||
} catch (PhutilAuthUserAbortedException $ex) { | } catch (PhutilAuthUserAbortedException $ex) { | ||||
if ($viewer->isLoggedIn()) { | if ($viewer->isLoggedIn()) { | ||||
// If a logged-in user cancels, take them back to the external accounts | // If a logged-in user cancels, take them back to the external accounts | ||||
// panel. | // panel. | ||||
▲ Show 20 Lines • Show All 52 Lines • ▼ Show 20 Lines | if ($account->getUserPHID()) { | ||||
'other Phabricator account and unlink the external account before '. | 'other Phabricator account and unlink the external account before '. | ||||
'linking it to a new Phabricator account.', | 'linking it to a new Phabricator account.', | ||||
$provider->getProviderName())); | $provider->getProviderName())); | ||||
} | } | ||||
} else { | } else { | ||||
// The account is not yet attached to a Phabricator user, so this is | // The account is not yet attached to a Phabricator user, so this is | ||||
// either a registration or an account link request. | // either a registration or an account link request. | ||||
if (!$viewer->isLoggedIn()) { | if (!$viewer->isLoggedIn()) { | ||||
if ($provider->shouldAllowRegistration()) { | if ($provider->shouldAllowRegistration() || $invite) { | ||||
return $this->processRegisterUser($account); | return $this->processRegisterUser($account); | ||||
} else { | } else { | ||||
return $this->renderError( | return $this->renderError( | ||||
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())); | ||||
▲ Show 20 Lines • Show All 153 Lines • Show Last 20 Lines |