diff --git a/src/applications/auth/controller/message/PhabricatorAuthMessageViewController.php b/src/applications/auth/controller/message/PhabricatorAuthMessageViewController.php --- a/src/applications/auth/controller/message/PhabricatorAuthMessageViewController.php +++ b/src/applications/auth/controller/message/PhabricatorAuthMessageViewController.php @@ -97,20 +97,35 @@ private function buildPropertiesView(PhabricatorAuthMessage $message) { $viewer = $this->getViewer(); + $message_type = $message->getMessageType(); + $view = id(new PHUIPropertyListView()) ->setViewer($viewer); - $view->addProperty( - pht('Description'), - $message->getMessageType()->getShortDescription()); + $full_description = $message_type->getFullDescription(); + if (strlen($full_description)) { + $view->addTextContent(new PHUIRemarkupView($viewer, $full_description)); + } else { + $short_description = $message_type->getShortDescription(); + $view->addProperty(pht('Description'), $short_description); + } - if (strlen($message->getMessageText())) { + $message_text = $message->getMessageText(); + if (strlen($message_text)) { $view->addSectionHeader( pht('Message Preview'), PHUIPropertyListView::ICON_SUMMARY); - $view->addTextContent( - new PHUIRemarkupView($viewer, $message->getMessageText())); + $view->addTextContent(new PHUIRemarkupView($viewer, $message_text)); + } + + $default_text = $message_type->getDefaultMessageText(); + if (strlen($default_text)) { + $view->addSectionHeader( + pht('Default Message'), + PHUIPropertyListView::ICON_SUMMARY); + + $view->addTextContent(new PHUIRemarkupView($viewer, $default_text)); } return $view; diff --git a/src/applications/auth/message/PhabricatorAuthEmailLoginMessageType.php b/src/applications/auth/message/PhabricatorAuthEmailLoginMessageType.php --- a/src/applications/auth/message/PhabricatorAuthEmailLoginMessageType.php +++ b/src/applications/auth/message/PhabricatorAuthEmailLoginMessageType.php @@ -15,4 +15,27 @@ 'to access their account.'); } + public function getFullDescription() { + return pht( + 'Guidance included in the mail message body when users request an '. + 'email link to access their account.'. + "\n\n". + 'For installs with password authentication enabled, users access this '. + 'workflow by using the "Forgot your password?" link on the login '. + 'screen.'. + "\n\n". + 'For installs without password authentication enabled, users access '. + 'this workflow by using the "Send a login link to your email address." '. + 'link on the login screen. This workflow allows users to recover '. + 'access to their account if there is an issue with an external '. + 'login service.'); + } + + public function getDefaultMessageText() { + return pht( + 'You (or someone pretending to be you) recently requested an account '. + 'recovery link be sent to this email address. If you did not make '. + 'this request, you can ignore this message.'); + } + } diff --git a/src/applications/auth/message/PhabricatorAuthMessageType.php b/src/applications/auth/message/PhabricatorAuthMessageType.php --- a/src/applications/auth/message/PhabricatorAuthMessageType.php +++ b/src/applications/auth/message/PhabricatorAuthMessageType.php @@ -30,4 +30,12 @@ abstract public function getDisplayName(); abstract public function getShortDescription(); + public function getFullDescription() { + return null; + } + + public function getDefaultMessageText() { + return null; + } + } diff --git a/src/applications/auth/storage/PhabricatorAuthMessage.php b/src/applications/auth/storage/PhabricatorAuthMessage.php --- a/src/applications/auth/storage/PhabricatorAuthMessage.php +++ b/src/applications/auth/storage/PhabricatorAuthMessage.php @@ -75,12 +75,16 @@ $message_key) { $message = self::loadMessage($viewer, $message_key); - - if (!$message) { - return null; + if ($message) { + $message_text = $message->getMessageText(); + if (strlen($message_text)) { + return $message_text; + } } - return $message->getMessageText(); + $message_type = PhabricatorAuthMessageType::newFromKey($message_key); + + return $message_type->getDefaultMessageText(); } diff --git a/src/applications/people/mail/PhabricatorPeopleMailEngine.php b/src/applications/people/mail/PhabricatorPeopleMailEngine.php --- a/src/applications/people/mail/PhabricatorPeopleMailEngine.php +++ b/src/applications/people/mail/PhabricatorPeopleMailEngine.php @@ -90,7 +90,10 @@ ->setConfig('uri.base', PhabricatorEnv::getProductionURI('/')) ->setMode(PhutilRemarkupEngine::MODE_TEXT); - return $engine->markupText($text); + $rendered_text = $engine->markupText($text); + $rendered_text = rtrim($rendered_text, "\n"); + + return $rendered_text; } }