Differential D20826 Diff 49656 src/applications/people/controller/PhabricatorPeopleRenameController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/people/controller/PhabricatorPeopleRenameController.php
Show All 37 Lines | if ($request->isFormOrHisecPost()) { | ||||
$editor->applyTransactions($user, $xactions); | $editor->applyTransactions($user, $xactions); | ||||
return id(new AphrontRedirectResponse())->setURI($done_uri); | return id(new AphrontRedirectResponse())->setURI($done_uri); | ||||
} catch (PhabricatorApplicationTransactionValidationException $ex) { | } catch (PhabricatorApplicationTransactionValidationException $ex) { | ||||
$validation_exception = $ex; | $validation_exception = $ex; | ||||
} | } | ||||
} | } | ||||
$inst1 = pht( | $instructions = array(); | ||||
'Be careful when renaming users!'); | |||||
$inst2 = pht( | $instructions[] = pht( | ||||
'The old username will no longer be tied to the user, so anything '. | 'If you rename this user, the old username will no longer be tied '. | ||||
'which uses it (like old commit messages) will no longer associate '. | 'to the user account. Anything which uses the old username in raw '. | ||||
'correctly. (And, if you give a user a username which some other user '. | 'text (like old commit messages) may no longer associate correctly.'); | ||||
'used to have, username lookups will begin returning the wrong user.)'); | |||||
$instructions[] = pht( | |||||
$inst3 = pht( | 'It is generally safe to rename users, but changing usernames may '. | ||||
'It is generally safe to rename newly created users (and test users '. | 'create occasional minor complications or confusion with text that '. | ||||
'and so on), but less safe to rename established users and unsafe to '. | 'contains the old username.'); | ||||
'reissue a username.'); | |||||
$inst4 = pht( | |||||
'Users who rely on password authentication will need to reset their '. | |||||
'password after their username is changed (their username is part of '. | |||||
'the salt in the password hash).'); | |||||
$inst5 = pht( | $instructions[] = pht( | ||||
'The user will receive an email notifying them that you changed their '. | 'The user will receive an email notifying them that you changed their '. | ||||
'username, with instructions for logging in and resetting their '. | 'username.'); | ||||
'password if necessary.'); | |||||
$instructions[] = null; | |||||
$form = id(new AphrontFormView()) | $form = id(new AphrontFormView()) | ||||
->setUser($viewer) | |||||
->appendChild( | ->appendChild( | ||||
id(new AphrontFormStaticControl()) | id(new AphrontFormStaticControl()) | ||||
->setLabel(pht('Old Username')) | ->setLabel(pht('Old Username')) | ||||
->setValue($user->getUsername())) | ->setValue($user->getUsername())) | ||||
->appendChild( | ->appendChild( | ||||
id(new AphrontFormTextControl()) | id(new AphrontFormTextControl()) | ||||
->setLabel(pht('New Username')) | ->setLabel(pht('New Username')) | ||||
->setValue($username) | ->setValue($username) | ||||
->setName('username')); | ->setName('username')); | ||||
return $this->newDialog() | $dialog = $this->newDialog() | ||||
->setWidth(AphrontDialogView::WIDTH_FORM) | |||||
->setTitle(pht('Change Username')) | ->setTitle(pht('Change Username')) | ||||
->setValidationException($validation_exception) | ->setValidationException($validation_exception); | ||||
->appendParagraph($inst1) | |||||
->appendParagraph($inst2) | foreach ($instructions as $instruction) { | ||||
->appendParagraph($inst3) | $dialog->appendParagraph($instruction); | ||||
->appendParagraph($inst4) | } | ||||
->appendParagraph($inst5) | |||||
->appendParagraph(null) | $dialog | ||||
->appendForm($form) | ->appendForm($form) | ||||
->addSubmitButton(pht('Rename User')) | ->addSubmitButton(pht('Rename User')) | ||||
->addCancelButton($done_uri); | ->addCancelButton($done_uri); | ||||
return $dialog; | |||||
} | } | ||||
} | } |