diff --git a/src/applications/auth/controller/PhabricatorAuthRegisterController.php b/src/applications/auth/controller/PhabricatorAuthRegisterController.php --- a/src/applications/auth/controller/PhabricatorAuthRegisterController.php +++ b/src/applications/auth/controller/PhabricatorAuthRegisterController.php @@ -11,6 +11,8 @@ $viewer = $this->getViewer(); $account_key = $request->getURIData('akey'); + $invite = $this->loadInvite(); + if ($request->getUser()->isLoggedIn()) { return $this->renderError(pht('You are already logged in.')); } @@ -25,7 +27,7 @@ $is_default = true; $is_setup = true; } else { - list($account, $provider, $response) = $this->loadDefaultAccount(); + list($account, $provider, $response) = $this->loadDefaultAccount($invite); $is_default = true; } @@ -33,8 +35,6 @@ return $response; } - $invite = $this->loadInvite(); - if (!$provider->shouldAllowRegistration()) { if ($invite) { // If the user has an invite, we allow them to register with any @@ -532,7 +532,7 @@ )); } - private function loadDefaultAccount() { + private function loadDefaultAccount($invite = false) { $providers = PhabricatorAuthProvider::getAllEnabledProviders(); $account = null; $provider = null; @@ -540,8 +540,10 @@ foreach ($providers as $key => $candidate_provider) { if (!$candidate_provider->shouldAllowRegistration()) { - unset($providers[$key]); - continue; + if (!$invite) { + unset($providers[$key]); + continue; + } } if (!$candidate_provider->isDefaultRegistrationProvider()) { unset($providers[$key]);