Changeset View
Changeset View
Standalone View
Standalone View
src/applications/people/storage/PhabricatorUser.php
Show First 20 Lines • Show All 549 Lines • ▼ Show 20 Lines | if ($sql) { | ||||
queryfx( | queryfx( | ||||
$conn_w, | $conn_w, | ||||
'INSERT INTO %T (userID, token) VALUES %LQ', | 'INSERT INTO %T (userID, token) VALUES %LQ', | ||||
$table, | $table, | ||||
$sql); | $sql); | ||||
} | } | ||||
} | } | ||||
public function sendUsernameChangeEmail( | |||||
PhabricatorUser $admin, | |||||
$old_username) { | |||||
$admin_username = $admin->getUserName(); | |||||
$admin_realname = $admin->getRealName(); | |||||
$new_username = $this->getUserName(); | |||||
$password_instructions = null; | |||||
if (PhabricatorPasswordAuthProvider::getPasswordProvider()) { | |||||
$engine = new PhabricatorAuthSessionEngine(); | |||||
$uri = $engine->getOneTimeLoginURI( | |||||
$this, | |||||
null, | |||||
PhabricatorAuthSessionEngine::ONETIME_USERNAME); | |||||
$password_instructions = sprintf( | |||||
"%s\n\n %s\n\n%s\n", | |||||
pht( | |||||
"If you use a password to login, you'll need to reset it ". | |||||
"before you can login again. You can reset your password by ". | |||||
"following this link:"), | |||||
$uri, | |||||
pht( | |||||
"And, of course, you'll need to use your new username to login ". | |||||
"from now on. If you use OAuth to login, nothing should change.")); | |||||
} | |||||
$body = sprintf( | |||||
"%s\n\n %s\n %s\n\n%s", | |||||
pht( | |||||
'%s (%s) has changed your Phabricator username.', | |||||
$admin_username, | |||||
$admin_realname), | |||||
pht( | |||||
'Old Username: %s', | |||||
$old_username), | |||||
pht( | |||||
'New Username: %s', | |||||
$new_username), | |||||
$password_instructions); | |||||
$mail = id(new PhabricatorMetaMTAMail()) | |||||
->addTos(array($this->getPHID())) | |||||
->setForceDelivery(true) | |||||
->setSubject(pht('[Phabricator] Username Changed')) | |||||
->setBody($body) | |||||
->saveAndSend(); | |||||
} | |||||
public static function describeValidUsername() { | public static function describeValidUsername() { | ||||
return pht( | return pht( | ||||
'Usernames must contain only numbers, letters, period, underscore and '. | 'Usernames must contain only numbers, letters, period, underscore and '. | ||||
'hyphen, and can not end with a period. They must have no more than %d '. | 'hyphen, and can not end with a period. They must have no more than %d '. | ||||
'characters.', | 'characters.', | ||||
new PhutilNumber(self::MAXIMUM_USERNAME_LENGTH)); | new PhutilNumber(self::MAXIMUM_USERNAME_LENGTH)); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 960 Lines • Show Last 20 Lines |