Changeset View
Changeset View
Standalone View
Standalone View
src/applications/auth/controller/PhabricatorEmailLoginController.php
| Show All 20 Lines | public function processRequest() { | ||||
| $is_serious = PhabricatorEnv::getEnvConfig('phabricator.serious-business'); | $is_serious = PhabricatorEnv::getEnvConfig('phabricator.serious-business'); | ||||
| if ($request->isFormPost()) { | if ($request->isFormPost()) { | ||||
| $e_email = null; | $e_email = null; | ||||
| $e_captcha = pht('Again'); | $e_captcha = pht('Again'); | ||||
| $captcha_ok = AphrontFormRecaptchaControl::processCaptcha($request); | $captcha_ok = AphrontFormRecaptchaControl::processCaptcha($request); | ||||
| if (!$captcha_ok) { | if (!$captcha_ok) { | ||||
| $errors[] = pht("Captcha response is incorrect, try again."); | $errors[] = pht('Captcha response is incorrect, try again.'); | ||||
| $e_captcha = pht('Invalid'); | $e_captcha = pht('Invalid'); | ||||
| } | } | ||||
| $email = $request->getStr('email'); | $email = $request->getStr('email'); | ||||
| if (!strlen($email)) { | if (!strlen($email)) { | ||||
| $errors[] = pht("You must provide an email address."); | $errors[] = pht('You must provide an email address.'); | ||||
| $e_email = pht('Required'); | $e_email = pht('Required'); | ||||
| } | } | ||||
| if (!$errors) { | if (!$errors) { | ||||
| // NOTE: Don't validate the email unless the captcha is good; this makes | // NOTE: Don't validate the email unless the captcha is good; this makes | ||||
| // it expensive to fish for valid email addresses while giving the user | // it expensive to fish for valid email addresses while giving the user | ||||
| // a better error if they goof their email. | // a better error if they goof their email. | ||||
| $target_email = id(new PhabricatorUserEmail())->loadOneWhere( | $target_email = id(new PhabricatorUserEmail())->loadOneWhere( | ||||
| 'address = %s', | 'address = %s', | ||||
| $email); | $email); | ||||
| $target_user = null; | $target_user = null; | ||||
| if ($target_email) { | if ($target_email) { | ||||
| $target_user = id(new PhabricatorUser())->loadOneWhere( | $target_user = id(new PhabricatorUser())->loadOneWhere( | ||||
| 'phid = %s', | 'phid = %s', | ||||
| $target_email->getUserPHID()); | $target_email->getUserPHID()); | ||||
| } | } | ||||
| if (!$target_user) { | if (!$target_user) { | ||||
| $errors[] = | $errors[] = | ||||
| pht("There is no account associated with that email address."); | pht('There is no account associated with that email address.'); | ||||
| $e_email = pht("Invalid"); | $e_email = pht('Invalid'); | ||||
| } | } | ||||
| if (!$errors) { | if (!$errors) { | ||||
| $engine = new PhabricatorAuthSessionEngine(); | $engine = new PhabricatorAuthSessionEngine(); | ||||
| $uri = $engine->getOneTimeLoginURI( | $uri = $engine->getOneTimeLoginURI( | ||||
| $target_user, | $target_user, | ||||
| null, | null, | ||||
| PhabricatorAuthSessionEngine::ONETIME_RESET); | PhabricatorAuthSessionEngine::ONETIME_RESET); | ||||
| ▲ Show 20 Lines • Show All 90 Lines • Show Last 20 Lines | |||||