mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-22 23:02:42 +01:00
Add support for custom "Wait for Approval" instructions
Summary: See PHI1229. An install has a somewhat duct-taped registration flow which can dump users on the "Wait for Approval" screen without clear guidance. The desired guidance is something like "this is totally normal, just wait a bit for a bot to approve you". Adding guidance here is generally reasonable and consistent with the intent of this feature. Test Plan: {F6426583} Reviewers: amckinley Reviewed By: amckinley Subscribers: kylec Differential Revision: https://secure.phabricator.com/D20492
This commit is contained in:
parent
e5fe4dffe1
commit
18f0f8b029
3 changed files with 55 additions and 3 deletions
|
@ -2419,6 +2419,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorAuthTryFactorAction' => 'applications/auth/action/PhabricatorAuthTryFactorAction.php',
|
||||
'PhabricatorAuthUnlinkController' => 'applications/auth/controller/PhabricatorAuthUnlinkController.php',
|
||||
'PhabricatorAuthValidateController' => 'applications/auth/controller/PhabricatorAuthValidateController.php',
|
||||
'PhabricatorAuthWaitForApprovalMessageType' => 'applications/auth/message/PhabricatorAuthWaitForApprovalMessageType.php',
|
||||
'PhabricatorAuthWelcomeMailMessageType' => 'applications/auth/message/PhabricatorAuthWelcomeMailMessageType.php',
|
||||
'PhabricatorAuthenticationConfigOptions' => 'applications/config/option/PhabricatorAuthenticationConfigOptions.php',
|
||||
'PhabricatorAutoEventListener' => 'infrastructure/events/PhabricatorAutoEventListener.php',
|
||||
|
@ -8357,6 +8358,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorAuthTryFactorAction' => 'PhabricatorSystemAction',
|
||||
'PhabricatorAuthUnlinkController' => 'PhabricatorAuthController',
|
||||
'PhabricatorAuthValidateController' => 'PhabricatorAuthController',
|
||||
'PhabricatorAuthWaitForApprovalMessageType' => 'PhabricatorAuthMessageType',
|
||||
'PhabricatorAuthWelcomeMailMessageType' => 'PhabricatorAuthMessageType',
|
||||
'PhabricatorAuthenticationConfigOptions' => 'PhabricatorApplicationConfigOptions',
|
||||
'PhabricatorAutoEventListener' => 'PhabricatorEventListener',
|
||||
|
|
|
@ -18,20 +18,51 @@ final class PhabricatorAuthNeedsApprovalController
|
|||
public function handleRequest(AphrontRequest $request) {
|
||||
$viewer = $this->getViewer();
|
||||
|
||||
$instructions = $this->newCustomWaitForApprovalInstructions();
|
||||
|
||||
$wait_for_approval = pht(
|
||||
"Your account has been created, but needs to be approved by an ".
|
||||
"administrator. You'll receive an email once your account is approved.");
|
||||
|
||||
$dialog = id(new AphrontDialogView())
|
||||
->setUser($viewer)
|
||||
$dialog = $this->newDialog()
|
||||
->setTitle(pht('Wait for Approval'))
|
||||
->appendChild($wait_for_approval)
|
||||
->addCancelButton('/', pht('Wait Patiently'));
|
||||
|
||||
$crumbs = $this->buildApplicationCrumbs()
|
||||
->addTextCrumb(pht('Wait For Approval'))
|
||||
->setBorder(true);
|
||||
|
||||
return $this->newPage()
|
||||
->setTitle(pht('Wait For Approval'))
|
||||
->appendChild($dialog);
|
||||
->setCrumbs($crumbs)
|
||||
->appendChild(
|
||||
array(
|
||||
$instructions,
|
||||
$dialog,
|
||||
));
|
||||
|
||||
}
|
||||
|
||||
private function newCustomWaitForApprovalInstructions() {
|
||||
$viewer = $this->getViewer();
|
||||
|
||||
$text = PhabricatorAuthMessage::loadMessageText(
|
||||
$viewer,
|
||||
PhabricatorAuthWaitForApprovalMessageType::MESSAGEKEY);
|
||||
|
||||
if (!strlen($text)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$remarkup_view = new PHUIRemarkupView($viewer, $text);
|
||||
|
||||
return phutil_tag(
|
||||
'div',
|
||||
array(
|
||||
'class' => 'auth-custom-message',
|
||||
),
|
||||
$remarkup_view);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
final class PhabricatorAuthWaitForApprovalMessageType
|
||||
extends PhabricatorAuthMessageType {
|
||||
|
||||
const MESSAGEKEY = 'auth.wait-for-approval';
|
||||
|
||||
public function getDisplayName() {
|
||||
return pht('Wait For Approval Instructions');
|
||||
}
|
||||
|
||||
public function getShortDescription() {
|
||||
return pht(
|
||||
'Instructions on the "Wait For Approval" screen, shown to users who '.
|
||||
'have registered an account that has not yet been approved by an '.
|
||||
'administrator.');
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue