diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -2265,6 +2265,8 @@ 'PhabricatorAuthDisableController' => 'applications/auth/controller/config/PhabricatorAuthDisableController.php', 'PhabricatorAuthDowngradeSessionController' => 'applications/auth/controller/PhabricatorAuthDowngradeSessionController.php', 'PhabricatorAuthEditController' => 'applications/auth/controller/config/PhabricatorAuthEditController.php', + 'PhabricatorAuthEmailLoginMessageType' => 'applications/auth/message/PhabricatorAuthEmailLoginMessageType.php', + 'PhabricatorAuthEmailSetPasswordMessageType' => 'applications/auth/message/PhabricatorAuthEmailSetPasswordMessageType.php', 'PhabricatorAuthFactor' => 'applications/auth/factor/PhabricatorAuthFactor.php', 'PhabricatorAuthFactorConfig' => 'applications/auth/storage/PhabricatorAuthFactorConfig.php', 'PhabricatorAuthFactorConfigQuery' => 'applications/auth/query/PhabricatorAuthFactorConfigQuery.php', @@ -8220,6 +8222,8 @@ 'PhabricatorAuthDisableController' => 'PhabricatorAuthProviderConfigController', 'PhabricatorAuthDowngradeSessionController' => 'PhabricatorAuthController', 'PhabricatorAuthEditController' => 'PhabricatorAuthProviderConfigController', + 'PhabricatorAuthEmailLoginMessageType' => 'PhabricatorAuthMessageType', + 'PhabricatorAuthEmailSetPasswordMessageType' => 'PhabricatorAuthMessageType', 'PhabricatorAuthFactor' => 'Phobject', 'PhabricatorAuthFactorConfig' => array( 'PhabricatorAuthDAO', diff --git a/src/applications/auth/message/PhabricatorAuthEmailLoginMessageType.php b/src/applications/auth/message/PhabricatorAuthEmailLoginMessageType.php new file mode 100644 --- /dev/null +++ b/src/applications/auth/message/PhabricatorAuthEmailLoginMessageType.php @@ -0,0 +1,18 @@ +getID()); + return urisprintf('/auth/message/%s/', $this->getID()); } public function attachMessageType(PhabricatorAuthMessageType $type) { diff --git a/src/applications/people/mail/PhabricatorPeopleEmailLoginMailEngine.php b/src/applications/people/mail/PhabricatorPeopleEmailLoginMailEngine.php --- a/src/applications/people/mail/PhabricatorPeopleEmailLoginMailEngine.php +++ b/src/applications/people/mail/PhabricatorPeopleEmailLoginMailEngine.php @@ -43,19 +43,34 @@ $is_serious = PhabricatorEnv::getEnvConfig('phabricator.serious-business'); $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 ($is_set_password) { - $body = pht( + $body[] = pht( 'You can use this link to set a password on your account:'. "\n\n %s\n", $login_uri); } else if ($is_serious) { - $body = pht( + $body[] = pht( "You can use this link to reset your Phabricator password:". "\n\n %s\n", $login_uri); } else { - $body = pht( + $body[] = pht( "Condolences on forgetting your password. You can use this ". "link to reset it:\n\n". " %s\n\n". @@ -68,7 +83,7 @@ } } else { - $body = pht( + $body[] = pht( "You can use this login link to regain access to your Phabricator ". "account:". "\n\n". @@ -76,6 +91,8 @@ $login_uri); } + $body = implode("\n\n", $body); + return id(new PhabricatorMetaMTAMail()) ->setSubject($subject) ->setBody($body);