mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-25 16:22:43 +01:00
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
This commit is contained in:
parent
0c331458a8
commit
6af776f84a
3 changed files with 41 additions and 1 deletions
|
@ -2268,6 +2268,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorAuthChallengeStatusController' => 'applications/auth/controller/mfa/PhabricatorAuthChallengeStatusController.php',
|
'PhabricatorAuthChallengeStatusController' => 'applications/auth/controller/mfa/PhabricatorAuthChallengeStatusController.php',
|
||||||
'PhabricatorAuthChallengeUpdate' => 'applications/auth/view/PhabricatorAuthChallengeUpdate.php',
|
'PhabricatorAuthChallengeUpdate' => 'applications/auth/view/PhabricatorAuthChallengeUpdate.php',
|
||||||
'PhabricatorAuthChangePasswordAction' => 'applications/auth/action/PhabricatorAuthChangePasswordAction.php',
|
'PhabricatorAuthChangePasswordAction' => 'applications/auth/action/PhabricatorAuthChangePasswordAction.php',
|
||||||
|
'PhabricatorAuthChangeUsernameMessageType' => 'applications/auth/message/PhabricatorAuthChangeUsernameMessageType.php',
|
||||||
'PhabricatorAuthConduitAPIMethod' => 'applications/auth/conduit/PhabricatorAuthConduitAPIMethod.php',
|
'PhabricatorAuthConduitAPIMethod' => 'applications/auth/conduit/PhabricatorAuthConduitAPIMethod.php',
|
||||||
'PhabricatorAuthConduitTokenRevoker' => 'applications/auth/revoker/PhabricatorAuthConduitTokenRevoker.php',
|
'PhabricatorAuthConduitTokenRevoker' => 'applications/auth/revoker/PhabricatorAuthConduitTokenRevoker.php',
|
||||||
'PhabricatorAuthConfirmLinkController' => 'applications/auth/controller/PhabricatorAuthConfirmLinkController.php',
|
'PhabricatorAuthConfirmLinkController' => 'applications/auth/controller/PhabricatorAuthConfirmLinkController.php',
|
||||||
|
@ -8455,6 +8456,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorAuthChallengeStatusController' => 'PhabricatorAuthController',
|
'PhabricatorAuthChallengeStatusController' => 'PhabricatorAuthController',
|
||||||
'PhabricatorAuthChallengeUpdate' => 'Phobject',
|
'PhabricatorAuthChallengeUpdate' => 'Phobject',
|
||||||
'PhabricatorAuthChangePasswordAction' => 'PhabricatorSystemAction',
|
'PhabricatorAuthChangePasswordAction' => 'PhabricatorSystemAction',
|
||||||
|
'PhabricatorAuthChangeUsernameMessageType' => 'PhabricatorAuthMessageType',
|
||||||
'PhabricatorAuthConduitAPIMethod' => 'ConduitAPIMethod',
|
'PhabricatorAuthConduitAPIMethod' => 'ConduitAPIMethod',
|
||||||
'PhabricatorAuthConduitTokenRevoker' => 'PhabricatorAuthRevoker',
|
'PhabricatorAuthConduitTokenRevoker' => 'PhabricatorAuthRevoker',
|
||||||
'PhabricatorAuthConfirmLinkController' => 'PhabricatorAuthController',
|
'PhabricatorAuthConfirmLinkController' => 'PhabricatorAuthController',
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
final class PhabricatorAuthChangeUsernameMessageType
|
||||||
|
extends PhabricatorAuthMessageType {
|
||||||
|
|
||||||
|
const MESSAGEKEY = 'user.edit.username';
|
||||||
|
|
||||||
|
public function getDisplayName() {
|
||||||
|
return pht('Username Change Instructions');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getShortDescription() {
|
||||||
|
return pht(
|
||||||
|
'Guidance in the "Change Username" dialog for requesting a '.
|
||||||
|
'username change.');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getFullDescription() {
|
||||||
|
return pht(
|
||||||
|
'When users click the "Change Username" action on their profile pages '.
|
||||||
|
'but do not have the required permissions, they will be presented with '.
|
||||||
|
'a message explaining that they are not authorized to make the edit.'.
|
||||||
|
"\n\n".
|
||||||
|
'You can optionally provide additional instructions here to help users '.
|
||||||
|
'request a username change, if there is someone specific they should '.
|
||||||
|
'contact or a particular workflow they should use.');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -23,13 +23,22 @@ final class PhabricatorPeopleRenameController
|
||||||
$done_uri = $this->getApplicationURI("manage/{$id}/");
|
$done_uri = $this->getApplicationURI("manage/{$id}/");
|
||||||
|
|
||||||
if (!$viewer->getIsAdmin()) {
|
if (!$viewer->getIsAdmin()) {
|
||||||
return $this->newDialog()
|
$dialog = $this->newDialog()
|
||||||
->setTitle(pht('Change Username'))
|
->setTitle(pht('Change Username'))
|
||||||
->appendParagraph(
|
->appendParagraph(
|
||||||
pht(
|
pht(
|
||||||
'You can not change usernames because you are not an '.
|
'You can not change usernames because you are not an '.
|
||||||
'administrator. Only administrators can change usernames.'))
|
'administrator. Only administrators can change usernames.'))
|
||||||
->addCancelButton($done_uri, pht('Okay'));
|
->addCancelButton($done_uri, pht('Okay'));
|
||||||
|
|
||||||
|
$message_body = PhabricatorAuthMessage::loadMessageText(
|
||||||
|
$viewer,
|
||||||
|
PhabricatorAuthChangeUsernameMessageType::MESSAGEKEY);
|
||||||
|
if (strlen($message_body)) {
|
||||||
|
$dialog->appendRemarkup($message_body);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $dialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
$validation_exception = null;
|
$validation_exception = null;
|
||||||
|
|
Loading…
Reference in a new issue