From 28858df713bbd95fa34a4ff500f7a66919302ab1 Mon Sep 17 00:00:00 2001 From: Jakub Vrana Date: Fri, 24 May 2013 16:05:14 -0700 Subject: [PATCH] Allow add_user.php without password auth Summary: Fixes T1527. Test Plan: Generated e-mail login URL. Enabled password auth, visited the URL, saw Change Password. Disabled password auth, enabled Facebook auth, visited the URL, saw Link Facebook account. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T1527 Differential Revision: https://secure.phabricator.com/D6006 --- .../PhabricatorEmailTokenController.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/applications/auth/controller/PhabricatorEmailTokenController.php b/src/applications/auth/controller/PhabricatorEmailTokenController.php index 16a828f7de..6681b97118 100644 --- a/src/applications/auth/controller/PhabricatorEmailTokenController.php +++ b/src/applications/auth/controller/PhabricatorEmailTokenController.php @@ -16,10 +16,6 @@ final class PhabricatorEmailTokenController public function processRequest() { $request = $this->getRequest(); - if (!PhabricatorEnv::getEnvConfig('auth.password-auth-enabled')) { - return new Aphront400Response(); - } - $token = $this->token; $email = $request->getStr('email'); @@ -81,15 +77,22 @@ final class PhabricatorEmailTokenController $request->setCookie('phusr', $target_user->getUsername()); $request->setCookie('phsid', $session_key); - if (PhabricatorEnv::getEnvConfig('account.editable')) { + $next = '/'; + if (!PhabricatorEnv::getEnvConfig('auth.password-auth-enabled')) { + $panels = id(new PhabricatorSettingsPanelOAuth())->buildPanels(); + foreach ($panels as $panel) { + if ($panel->isEnabled()) { + $next = $panel->getPanelURI(); + break; + } + } + } else if (PhabricatorEnv::getEnvConfig('account.editable')) { $next = (string)id(new PhutilURI('/settings/panel/password/')) ->setQueryParams( array( 'token' => $token, 'email' => $email, )); - } else { - $next = '/'; } $uri = new PhutilURI('/login/validate/');