Page MenuHomePhabricator

D20663.diff
No OneTemporary

D20663.diff

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 @@
+<?php
+
+final class PhabricatorAuthEmailLoginMessageType
+ extends PhabricatorAuthMessageType {
+
+ const MESSAGEKEY = 'mail.login';
+
+ public function getDisplayName() {
+ return pht('Mail Body: Email Login');
+ }
+
+ public function getShortDescription() {
+ return pht(
+ 'Guidance in the message body when users request an email link '.
+ 'to access their account.');
+ }
+
+}
diff --git a/src/applications/auth/message/PhabricatorAuthEmailSetPasswordMessageType.php b/src/applications/auth/message/PhabricatorAuthEmailSetPasswordMessageType.php
new file mode 100644
--- /dev/null
+++ b/src/applications/auth/message/PhabricatorAuthEmailSetPasswordMessageType.php
@@ -0,0 +1,18 @@
+<?php
+
+final class PhabricatorAuthEmailSetPasswordMessageType
+ extends PhabricatorAuthMessageType {
+
+ const MESSAGEKEY = 'mail.set-password';
+
+ public function getDisplayName() {
+ return pht('Mail Body: Set Password');
+ }
+
+ public function getShortDescription() {
+ return pht(
+ 'Guidance in the message body when users set a password on an account '.
+ 'which did not previously have a password.');
+ }
+
+}
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
@@ -28,5 +28,6 @@
}
abstract public function getDisplayName();
+ abstract public function getShortDescription();
}
diff --git a/src/applications/auth/message/PhabricatorAuthWelcomeMailMessageType.php b/src/applications/auth/message/PhabricatorAuthWelcomeMailMessageType.php
--- a/src/applications/auth/message/PhabricatorAuthWelcomeMailMessageType.php
+++ b/src/applications/auth/message/PhabricatorAuthWelcomeMailMessageType.php
@@ -6,7 +6,7 @@
const MESSAGEKEY = 'mail.welcome';
public function getDisplayName() {
- return pht('Welcome Email Body');
+ return pht('Mail Body: Welcome');
}
public function getShortDescription() {
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
@@ -45,7 +45,7 @@
}
public function getURI() {
- return urisprintf('/auth/message/%s', $this->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);

File Metadata

Mime Type
text/plain
Expires
Thu, May 16, 1:23 AM (2 w, 2 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6289653
Default Alt Text
D20663.diff (6 KB)

Event Timeline