@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Allow users to register with non-registration providers if they are invited to an instance

Summary:
Depends on D20117. Fixes T10071. When you're sent an email invitation, it's intended to allow you to register an account even if you otherwise could not (see D11737).

Some time between D11737 and today, this stopped working (or perhaps it never worked and I got things wrong in D11737). I think this actually ended up not mattering for us, given the way Phacility auth was ultimately built.

This feature generally seems reasonable, though, and probably //should// work. Make it work in the "password" and "oauth" cases, at least. This may //still// not work for LDAP, but testing that is nontrivial.

Test Plan:
- Enabled only passwords, turned off registration, sent an invite, registered with a password.
- Enabled only Google OAuth, turned off registration, sent an invite, registered with Google OAuth.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T10071

Differential Revision: https://secure.phabricator.com/D20118

+13 -9
+2 -1
src/applications/auth/controller/PhabricatorAuthLoginController.php
··· 35 35 return $response; 36 36 } 37 37 38 + $invite = $this->loadInvite(); 38 39 $provider = $this->provider; 39 40 40 41 try { ··· 103 104 // The account is not yet attached to a Phabricator user, so this is 104 105 // either a registration or an account link request. 105 106 if (!$viewer->isLoggedIn()) { 106 - if ($provider->shouldAllowRegistration()) { 107 + if ($provider->shouldAllowRegistration() || $invite) { 107 108 return $this->processRegisterUser($account); 108 109 } else { 109 110 return $this->renderError(
+11 -8
src/applications/auth/controller/PhabricatorAuthRegisterController.php
··· 11 11 $viewer = $this->getViewer(); 12 12 $account_key = $request->getURIData('akey'); 13 13 14 - if ($request->getUser()->isLoggedIn()) { 14 + if ($viewer->isLoggedIn()) { 15 15 return id(new AphrontRedirectResponse())->setURI('/'); 16 16 } 17 + 18 + $invite = $this->loadInvite(); 17 19 18 20 $is_setup = false; 19 21 if (strlen($account_key)) { ··· 27 29 $is_default = true; 28 30 $is_setup = true; 29 31 } else { 30 - list($account, $provider, $response) = $this->loadDefaultAccount(); 32 + list($account, $provider, $response) = $this->loadDefaultAccount($invite); 31 33 $is_default = true; 32 34 } 33 35 34 36 if ($response) { 35 37 return $response; 36 38 } 37 - 38 - $invite = $this->loadInvite(); 39 39 40 40 if (!$is_setup) { 41 41 if (!$provider->shouldAllowRegistration()) { ··· 643 643 ->appendChild($view); 644 644 } 645 645 646 - private function loadDefaultAccount() { 646 + private function loadDefaultAccount($invite) { 647 647 $providers = PhabricatorAuthProvider::getAllEnabledProviders(); 648 648 $account = null; 649 649 $provider = null; 650 650 $response = null; 651 651 652 652 foreach ($providers as $key => $candidate_provider) { 653 - if (!$candidate_provider->shouldAllowRegistration()) { 654 - unset($providers[$key]); 655 - continue; 653 + if (!$invite) { 654 + if (!$candidate_provider->shouldAllowRegistration()) { 655 + unset($providers[$key]); 656 + continue; 657 + } 656 658 } 659 + 657 660 if (!$candidate_provider->isDefaultRegistrationProvider()) { 658 661 unset($providers[$key]); 659 662 }