Skip to content

Commit 6af776f

Browse files
author
epriestley
committedSep 24, 2019
Allow installs to provide "Request a Username Change" instructions
Summary: Fixes T13420. Allow installs to provide username change instructions if there's someone you should contact to get this done. Test Plan: {F6885027} Maniphest Tasks: T13420 Differential Revision: https://secure.phabricator.com/D20828
1 parent 0c33145 commit 6af776f

File tree

3 files changed

+41
-1
lines changed

3 files changed

+41
-1
lines changed
 

‎src/__phutil_library_map__.php

+2
Original file line numberDiff line numberDiff line change
@@ -2268,6 +2268,7 @@
22682268
'PhabricatorAuthChallengeStatusController' => 'applications/auth/controller/mfa/PhabricatorAuthChallengeStatusController.php',
22692269
'PhabricatorAuthChallengeUpdate' => 'applications/auth/view/PhabricatorAuthChallengeUpdate.php',
22702270
'PhabricatorAuthChangePasswordAction' => 'applications/auth/action/PhabricatorAuthChangePasswordAction.php',
2271+
'PhabricatorAuthChangeUsernameMessageType' => 'applications/auth/message/PhabricatorAuthChangeUsernameMessageType.php',
22712272
'PhabricatorAuthConduitAPIMethod' => 'applications/auth/conduit/PhabricatorAuthConduitAPIMethod.php',
22722273
'PhabricatorAuthConduitTokenRevoker' => 'applications/auth/revoker/PhabricatorAuthConduitTokenRevoker.php',
22732274
'PhabricatorAuthConfirmLinkController' => 'applications/auth/controller/PhabricatorAuthConfirmLinkController.php',
@@ -8455,6 +8456,7 @@
84558456
'PhabricatorAuthChallengeStatusController' => 'PhabricatorAuthController',
84568457
'PhabricatorAuthChallengeUpdate' => 'Phobject',
84578458
'PhabricatorAuthChangePasswordAction' => 'PhabricatorSystemAction',
8459+
'PhabricatorAuthChangeUsernameMessageType' => 'PhabricatorAuthMessageType',
84588460
'PhabricatorAuthConduitAPIMethod' => 'ConduitAPIMethod',
84598461
'PhabricatorAuthConduitTokenRevoker' => 'PhabricatorAuthRevoker',
84608462
'PhabricatorAuthConfirmLinkController' => 'PhabricatorAuthController',
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
final class PhabricatorAuthChangeUsernameMessageType
4+
extends PhabricatorAuthMessageType {
5+
6+
const MESSAGEKEY = 'user.edit.username';
7+
8+
public function getDisplayName() {
9+
return pht('Username Change Instructions');
10+
}
11+
12+
public function getShortDescription() {
13+
return pht(
14+
'Guidance in the "Change Username" dialog for requesting a '.
15+
'username change.');
16+
}
17+
18+
public function getFullDescription() {
19+
return pht(
20+
'When users click the "Change Username" action on their profile pages '.
21+
'but do not have the required permissions, they will be presented with '.
22+
'a message explaining that they are not authorized to make the edit.'.
23+
"\n\n".
24+
'You can optionally provide additional instructions here to help users '.
25+
'request a username change, if there is someone specific they should '.
26+
'contact or a particular workflow they should use.');
27+
}
28+
29+
}

‎src/applications/people/controller/PhabricatorPeopleRenameController.php

+10-1
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,22 @@ public function handleRequest(AphrontRequest $request) {
2323
$done_uri = $this->getApplicationURI("manage/{$id}/");
2424

2525
if (!$viewer->getIsAdmin()) {
26-
return $this->newDialog()
26+
$dialog = $this->newDialog()
2727
->setTitle(pht('Change Username'))
2828
->appendParagraph(
2929
pht(
3030
'You can not change usernames because you are not an '.
3131
'administrator. Only administrators can change usernames.'))
3232
->addCancelButton($done_uri, pht('Okay'));
33+
34+
$message_body = PhabricatorAuthMessage::loadMessageText(
35+
$viewer,
36+
PhabricatorAuthChangeUsernameMessageType::MESSAGEKEY);
37+
if (strlen($message_body)) {
38+
$dialog->appendRemarkup($message_body);
39+
}
40+
41+
return $dialog;
3342
}
3443

3544
$validation_exception = null;

0 commit comments

Comments
 (0)
Failed to load comments.