Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15445398
D20663.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
6 KB
Referenced Files
None
Subscribers
None
D20663.diff
View Options
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
Details
Attached
Mime Type
text/plain
Expires
Fri, Mar 28, 1:43 PM (3 d, 2 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7221643
Default Alt Text
D20663.diff (6 KB)
Attached To
Mode
D20663: Allow installs to customize mail body guidance in the "Email Login" and "Set Password" emails
Attached
Detach File
Event Timeline
Log In to Comment