1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-20 01:08:50 +02:00

When password auth is not enabled, don't tell users to set a password in welcome email

Summary:
See PHI1027. Currently, the "Welcome" mail always tells users to set a password. This definitely isn't helpful if an install doesn't have password auth enabled.

We can't necessarily guess what they're supposed to do, so just give them generic instructions ("set up your account"). Upcoming changes will give administrators more control over the mail content.

Test Plan: Sent both versions of the mail, used `bin/mail show-outbound` to inspect them for correctness.

Reviewers: amckinley

Reviewed By: amckinley

Differential Revision: https://secure.phabricator.com/D19990
This commit is contained in:
epriestley 2019-01-17 10:02:42 -08:00
parent 5537e29ee8
commit 7f950f520b

View file

@ -38,9 +38,6 @@ final class PhabricatorPeopleWelcomeMailEngine
$sender = $this->getSender();
$recipient = $this->getRecipient();
$sender_username = $sender->getUserName();
$sender_realname = $sender->getRealName();
$recipient_username = $recipient->getUserName();
$is_serious = PhabricatorEnv::getEnvConfig('phabricator.serious-business');
@ -53,31 +50,54 @@ final class PhabricatorPeopleWelcomeMailEngine
$recipient->loadPrimaryEmail(),
PhabricatorAuthSessionEngine::ONETIME_WELCOME);
$body = pht(
"Welcome to Phabricator!\n\n".
"%s (%s) has created an account for you.\n\n".
" Username: %s\n\n".
"To login to Phabricator, follow this link and set a password:\n\n".
" %s\n\n".
"After you have set a password, you can login in the future by ".
"going here:\n\n".
" %s\n",
$sender_username,
$sender_realname,
$recipient_username,
$uri,
$base_uri);
$message = array();
$message[] = pht('Welcome to Phabricator!');
$message[] = pht(
'%s (%s) has created an account for you.',
$sender->getUsername(),
$sender->getRealName());
$message[] = pht(
' Username: %s',
$recipient->getUsername());
// If password auth is enabled, give the user specific instructions about
// how to add a credential to their account.
// If we aren't sure what they're supposed to be doing and passwords are
// not enabled, just give them generic instructions.
$use_passwords = PhabricatorPasswordAuthProvider::getPasswordProvider();
if ($use_passwords) {
$message[] = pht(
'To log in to Phabricator, follow this link and set a password:');
$message[] = pht(' %s', $uri);
$message[] = pht(
'After you have set a password, you can log in to Phabricator in '.
'the future by going here:');
$message[] = pht(' %s', $base_uri);
} else {
$message[] = pht(
'To log in to your account for the first time, follow this link:');
$message[] = pht(' %s', $uri);
$message[] = pht(
'After you set up your account, you can log in to Phabricator in '.
'the future by going here:');
$message[] = pht(' %s', $base_uri);
}
if (!$is_serious) {
$body .= sprintf(
"\n%s\n",
pht("Love,\nPhabricator"));
$message[] = pht("Love,\nPhabricator");
}
$message = implode("\n\n", $message);
return id(new PhabricatorMetaMTAMail())
->addTos(array($recipient->getPHID()))
->setSubject(pht('[Phabricator] Welcome to Phabricator'))
->setBody($body);
->setBody($message);
}
}