Page MenuHomePhabricator

D20118.diff
No OneTemporary

D20118.diff

diff --git a/src/applications/auth/controller/PhabricatorAuthLoginController.php b/src/applications/auth/controller/PhabricatorAuthLoginController.php
--- a/src/applications/auth/controller/PhabricatorAuthLoginController.php
+++ b/src/applications/auth/controller/PhabricatorAuthLoginController.php
@@ -35,6 +35,7 @@
return $response;
}
+ $invite = $this->loadInvite();
$provider = $this->provider;
try {
@@ -103,7 +104,7 @@
// The account is not yet attached to a Phabricator user, so this is
// either a registration or an account link request.
if (!$viewer->isLoggedIn()) {
- if ($provider->shouldAllowRegistration()) {
+ if ($provider->shouldAllowRegistration() || $invite) {
return $this->processRegisterUser($account);
} else {
return $this->renderError(
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,10 +11,12 @@
$viewer = $this->getViewer();
$account_key = $request->getURIData('akey');
- if ($request->getUser()->isLoggedIn()) {
+ if ($viewer->isLoggedIn()) {
return id(new AphrontRedirectResponse())->setURI('/');
}
+ $invite = $this->loadInvite();
+
$is_setup = false;
if (strlen($account_key)) {
$result = $this->loadAccountForRegistrationOrLinking($account_key);
@@ -27,7 +29,7 @@
$is_default = true;
$is_setup = true;
} else {
- list($account, $provider, $response) = $this->loadDefaultAccount();
+ list($account, $provider, $response) = $this->loadDefaultAccount($invite);
$is_default = true;
}
@@ -35,8 +37,6 @@
return $response;
}
- $invite = $this->loadInvite();
-
if (!$is_setup) {
if (!$provider->shouldAllowRegistration()) {
if ($invite) {
@@ -643,17 +643,20 @@
->appendChild($view);
}
- private function loadDefaultAccount() {
+ private function loadDefaultAccount($invite) {
$providers = PhabricatorAuthProvider::getAllEnabledProviders();
$account = null;
$provider = null;
$response = null;
foreach ($providers as $key => $candidate_provider) {
- if (!$candidate_provider->shouldAllowRegistration()) {
- unset($providers[$key]);
- continue;
+ if (!$invite) {
+ if (!$candidate_provider->shouldAllowRegistration()) {
+ unset($providers[$key]);
+ continue;
+ }
}
+
if (!$candidate_provider->isDefaultRegistrationProvider()) {
unset($providers[$key]);
}

File Metadata

Mime Type
text/plain
Expires
Wed, Dec 25, 12:13 PM (10 h, 40 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6926186
Default Alt Text
D20118.diff (2 KB)

Event Timeline