Differential D20663 Diff 49289 src/applications/people/mail/PhabricatorPeopleEmailLoginMailEngine.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/people/mail/PhabricatorPeopleEmailLoginMailEngine.php
| Show All 37 Lines | protected function newMail() { | ||||
| $login_uri = $engine->getOneTimeLoginURI( | $login_uri = $engine->getOneTimeLoginURI( | ||||
| $recipient, | $recipient, | ||||
| null, | null, | ||||
| PhabricatorAuthSessionEngine::ONETIME_RESET); | PhabricatorAuthSessionEngine::ONETIME_RESET); | ||||
| $is_serious = PhabricatorEnv::getEnvConfig('phabricator.serious-business'); | $is_serious = PhabricatorEnv::getEnvConfig('phabricator.serious-business'); | ||||
| $have_passwords = $this->isPasswordAuthEnabled(); | $have_passwords = $this->isPasswordAuthEnabled(); | ||||
| $body = array(); | |||||
| if ($is_set_password) { | |||||
| $message_key = PhabricatorAuthEmailSetPasswordMessageType::MESSAGEKEY; | |||||
| } else { | |||||
| $message_key = PhabricatorAuthEmailLoginMessageType::MESSAGEKEY; | |||||
| } | |||||
| $message_body = PhabricatorAuthMessage::loadMessageText( | |||||
| $recipient, | |||||
| $message_key); | |||||
| if (strlen($message_body)) { | |||||
| $body[] = $this->newRemarkupText($message_body); | |||||
| } | |||||
| if ($have_passwords) { | if ($have_passwords) { | ||||
| if ($is_set_password) { | if ($is_set_password) { | ||||
| $body = pht( | $body[] = pht( | ||||
| 'You can use this link to set a password on your account:'. | 'You can use this link to set a password on your account:'. | ||||
| "\n\n %s\n", | "\n\n %s\n", | ||||
| $login_uri); | $login_uri); | ||||
| } else if ($is_serious) { | } else if ($is_serious) { | ||||
| $body = pht( | $body[] = pht( | ||||
| "You can use this link to reset your Phabricator password:". | "You can use this link to reset your Phabricator password:". | ||||
| "\n\n %s\n", | "\n\n %s\n", | ||||
| $login_uri); | $login_uri); | ||||
| } else { | } else { | ||||
| $body = pht( | $body[] = pht( | ||||
| "Condolences on forgetting your password. You can use this ". | "Condolences on forgetting your password. You can use this ". | ||||
| "link to reset it:\n\n". | "link to reset it:\n\n". | ||||
| " %s\n\n". | " %s\n\n". | ||||
| "After you set a new password, consider writing it down on a ". | "After you set a new password, consider writing it down on a ". | ||||
| "sticky note and attaching it to your monitor so you don't ". | "sticky note and attaching it to your monitor so you don't ". | ||||
| "forget again! Choosing a very short, easy-to-remember password ". | "forget again! Choosing a very short, easy-to-remember password ". | ||||
| "like \"cat\" or \"1234\" might also help.\n\n". | "like \"cat\" or \"1234\" might also help.\n\n". | ||||
| "Best Wishes,\nPhabricator\n", | "Best Wishes,\nPhabricator\n", | ||||
| $login_uri); | $login_uri); | ||||
| } | } | ||||
| } else { | } else { | ||||
| $body = pht( | $body[] = pht( | ||||
| "You can use this login link to regain access to your Phabricator ". | "You can use this login link to regain access to your Phabricator ". | ||||
| "account:". | "account:". | ||||
| "\n\n". | "\n\n". | ||||
| " %s\n", | " %s\n", | ||||
| $login_uri); | $login_uri); | ||||
| } | } | ||||
| $body = implode("\n\n", $body); | |||||
| return id(new PhabricatorMetaMTAMail()) | return id(new PhabricatorMetaMTAMail()) | ||||
| ->setSubject($subject) | ->setSubject($subject) | ||||
| ->setBody($body); | ->setBody($body); | ||||
| } | } | ||||
| private function isPasswordAuthEnabled() { | private function isPasswordAuthEnabled() { | ||||
| return (bool)PhabricatorPasswordAuthProvider::getPasswordProvider(); | return (bool)PhabricatorPasswordAuthProvider::getPasswordProvider(); | ||||
| } | } | ||||
| Show All 21 Lines | |||||