@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+41 -21
+41 -21
src/applications/people/mail/PhabricatorPeopleWelcomeMailEngine.php
··· 38 38 $sender = $this->getSender(); 39 39 $recipient = $this->getRecipient(); 40 40 41 - $sender_username = $sender->getUserName(); 42 - $sender_realname = $sender->getRealName(); 43 - 44 41 $recipient_username = $recipient->getUserName(); 45 42 $is_serious = PhabricatorEnv::getEnvConfig('phabricator.serious-business'); 46 43 ··· 53 50 $recipient->loadPrimaryEmail(), 54 51 PhabricatorAuthSessionEngine::ONETIME_WELCOME); 55 52 56 - $body = pht( 57 - "Welcome to Phabricator!\n\n". 58 - "%s (%s) has created an account for you.\n\n". 59 - " Username: %s\n\n". 60 - "To login to Phabricator, follow this link and set a password:\n\n". 61 - " %s\n\n". 62 - "After you have set a password, you can login in the future by ". 63 - "going here:\n\n". 64 - " %s\n", 65 - $sender_username, 66 - $sender_realname, 67 - $recipient_username, 68 - $uri, 69 - $base_uri); 53 + $message = array(); 54 + 55 + $message[] = pht('Welcome to Phabricator!'); 56 + 57 + $message[] = pht( 58 + '%s (%s) has created an account for you.', 59 + $sender->getUsername(), 60 + $sender->getRealName()); 61 + 62 + $message[] = pht( 63 + ' Username: %s', 64 + $recipient->getUsername()); 65 + 66 + // If password auth is enabled, give the user specific instructions about 67 + // how to add a credential to their account. 68 + 69 + // If we aren't sure what they're supposed to be doing and passwords are 70 + // not enabled, just give them generic instructions. 71 + 72 + $use_passwords = PhabricatorPasswordAuthProvider::getPasswordProvider(); 73 + if ($use_passwords) { 74 + $message[] = pht( 75 + 'To log in to Phabricator, follow this link and set a password:'); 76 + $message[] = pht(' %s', $uri); 77 + $message[] = pht( 78 + 'After you have set a password, you can log in to Phabricator in '. 79 + 'the future by going here:'); 80 + $message[] = pht(' %s', $base_uri); 81 + } else { 82 + $message[] = pht( 83 + 'To log in to your account for the first time, follow this link:'); 84 + $message[] = pht(' %s', $uri); 85 + $message[] = pht( 86 + 'After you set up your account, you can log in to Phabricator in '. 87 + 'the future by going here:'); 88 + $message[] = pht(' %s', $base_uri); 89 + } 70 90 71 91 if (!$is_serious) { 72 - $body .= sprintf( 73 - "\n%s\n", 74 - pht("Love,\nPhabricator")); 92 + $message[] = pht("Love,\nPhabricator"); 75 93 } 76 94 95 + $message = implode("\n\n", $message); 96 + 77 97 return id(new PhabricatorMetaMTAMail()) 78 98 ->addTos(array($recipient->getPHID())) 79 99 ->setSubject(pht('[Phabricator] Welcome to Phabricator')) 80 - ->setBody($body); 100 + ->setBody($message); 81 101 } 82 102 83 103 }