3 files changed +41
-1
lines changed Original file line number Diff line number Diff line change 2268
2268
'PhabricatorAuthChallengeStatusController' => 'applications/auth/controller/mfa/PhabricatorAuthChallengeStatusController.php',
2269
2269
'PhabricatorAuthChallengeUpdate' => 'applications/auth/view/PhabricatorAuthChallengeUpdate.php',
2270
2270
'PhabricatorAuthChangePasswordAction' => 'applications/auth/action/PhabricatorAuthChangePasswordAction.php',
2271
+ 'PhabricatorAuthChangeUsernameMessageType' => 'applications/auth/message/PhabricatorAuthChangeUsernameMessageType.php',
2271
2272
'PhabricatorAuthConduitAPIMethod' => 'applications/auth/conduit/PhabricatorAuthConduitAPIMethod.php',
2272
2273
'PhabricatorAuthConduitTokenRevoker' => 'applications/auth/revoker/PhabricatorAuthConduitTokenRevoker.php',
2273
2274
'PhabricatorAuthConfirmLinkController' => 'applications/auth/controller/PhabricatorAuthConfirmLinkController.php',
8455
8456
'PhabricatorAuthChallengeStatusController' => 'PhabricatorAuthController',
8456
8457
'PhabricatorAuthChallengeUpdate' => 'Phobject',
8457
8458
'PhabricatorAuthChangePasswordAction' => 'PhabricatorSystemAction',
8459
+ 'PhabricatorAuthChangeUsernameMessageType' => 'PhabricatorAuthMessageType',
8458
8460
'PhabricatorAuthConduitAPIMethod' => 'ConduitAPIMethod',
8459
8461
'PhabricatorAuthConduitTokenRevoker' => 'PhabricatorAuthRevoker',
8460
8462
'PhabricatorAuthConfirmLinkController' => 'PhabricatorAuthController',
Original file line number Diff line number Diff line change
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
+ }
Original file line number Diff line number Diff line change @@ -23,13 +23,22 @@ public function handleRequest(AphrontRequest $request) {
23
23
$ done_uri = $ this ->getApplicationURI ("manage/ {$ id }/ " );
24
24
25
25
if (!$ viewer ->getIsAdmin ()) {
26
- return $ this ->newDialog ()
26
+ $ dialog = $ this ->newDialog ()
27
27
->setTitle (pht ('Change Username ' ))
28
28
->appendParagraph (
29
29
pht (
30
30
'You can not change usernames because you are not an ' .
31
31
'administrator. Only administrators can change usernames. ' ))
32
32
->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 ;
33
42
}
34
43
35
44
$ validation_exception = null ;
0 commit comments