From 18f0f8b029a9a4e53cb7bfc289d4cec3d4f2bbbd Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 3 May 2019 08:26:23 -0700 Subject: [PATCH] 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 --- src/__phutil_library_map__.php | 2 + ...PhabricatorAuthNeedsApprovalController.php | 37 +++++++++++++++++-- ...bricatorAuthWaitForApprovalMessageType.php | 19 ++++++++++ 3 files changed, 55 insertions(+), 3 deletions(-) create mode 100644 src/applications/auth/message/PhabricatorAuthWaitForApprovalMessageType.php diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 5f28529e80..14039562b6 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -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', diff --git a/src/applications/auth/controller/PhabricatorAuthNeedsApprovalController.php b/src/applications/auth/controller/PhabricatorAuthNeedsApprovalController.php index ba28816375..1121dfb14a 100644 --- a/src/applications/auth/controller/PhabricatorAuthNeedsApprovalController.php +++ b/src/applications/auth/controller/PhabricatorAuthNeedsApprovalController.php @@ -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); + } + } diff --git a/src/applications/auth/message/PhabricatorAuthWaitForApprovalMessageType.php b/src/applications/auth/message/PhabricatorAuthWaitForApprovalMessageType.php new file mode 100644 index 0000000000..d09dc6094e --- /dev/null +++ b/src/applications/auth/message/PhabricatorAuthWaitForApprovalMessageType.php @@ -0,0 +1,19 @@ +