Changeset View
Changeset View
Standalone View
Standalone View
src/applications/auth/provider/PhabricatorPasswordAuthProvider.php
| Show First 20 Lines • Show All 299 Lines • ▼ Show 20 Lines | if ($request->isFormPost()) { | ||||
| $engine = id(new PhabricatorAuthPasswordEngine()) | $engine = id(new PhabricatorAuthPasswordEngine()) | ||||
| ->setViewer($user) | ->setViewer($user) | ||||
| ->setContentSource($content_source) | ->setContentSource($content_source) | ||||
| ->setPasswordType(PhabricatorAuthPassword::PASSWORD_TYPE_ACCOUNT) | ->setPasswordType(PhabricatorAuthPassword::PASSWORD_TYPE_ACCOUNT) | ||||
| ->setObject($user); | ->setObject($user); | ||||
| if ($engine->isValidPassword($envelope)) { | if ($engine->isValidPassword($envelope)) { | ||||
| $account = $this->loadOrCreateAccount($user->getPHID()); | $account = $this->newExternalAccountForUser($user); | ||||
| $log_user = $user; | $log_user = $user; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| if (!$account) { | if (!$account) { | ||||
| Show All 17 Lines | public function processLoginRequest( | ||||
| return array($account, $response); | return array($account, $response); | ||||
| } | } | ||||
| public function shouldRequireRegistrationPassword() { | public function shouldRequireRegistrationPassword() { | ||||
| return true; | return true; | ||||
| } | } | ||||
| protected function willSaveAccount(PhabricatorExternalAccount $account) { | |||||
| parent::willSaveAccount($account); | |||||
| $account->setUserPHID($account->getAccountID()); | |||||
| } | |||||
| public function willRegisterAccount(PhabricatorExternalAccount $account) { | |||||
| parent::willRegisterAccount($account); | |||||
| $account->setAccountID($account->getUserPHID()); | |||||
| } | |||||
| public static function getPasswordProvider() { | public static function getPasswordProvider() { | ||||
| $providers = self::getAllEnabledProviders(); | $providers = self::getAllEnabledProviders(); | ||||
| foreach ($providers as $provider) { | foreach ($providers as $provider) { | ||||
| if ($provider instanceof PhabricatorPasswordAuthProvider) { | if ($provider instanceof PhabricatorPasswordAuthProvider) { | ||||
| return $provider; | return $provider; | ||||
| } | } | ||||
| } | } | ||||
| Show All 10 Lines | final class PhabricatorPasswordAuthProvider extends PhabricatorAuthProvider { | ||||
| public function shouldAllowAccountRefresh() { | public function shouldAllowAccountRefresh() { | ||||
| return false; | return false; | ||||
| } | } | ||||
| public function shouldAllowEmailTrustConfiguration() { | public function shouldAllowEmailTrustConfiguration() { | ||||
| return false; | return false; | ||||
| } | } | ||||
| } | } | ||||