1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-11 07:11:04 +01:00

When users try to log out with no providers configured, warn them of the consequences

Summary: Fixes T13406. On the logout screen, test for no configured providers and warn users they may be getting into more trouble than they expect.

Test Plan:
  - Logged out of a normal install and a fresh (unconfigured) install.

{F6847659}

Maniphest Tasks: T13406

Differential Revision: https://secure.phabricator.com/D20789
This commit is contained in:
epriestley 2019-09-08 09:45:53 -07:00
parent 318e8ebdac
commit caccbb69d2
3 changed files with 48 additions and 4 deletions

View file

@ -68,12 +68,42 @@ final class PhabricatorLogoutController
->setURI('/auth/loggedout/');
}
if ($viewer->getPHID()) {
return $this->newDialog()
$dialog = $this->newDialog()
->setTitle(pht('Log Out?'))
->appendChild(pht('Are you sure you want to log out?'))
->addSubmitButton(pht('Log Out'))
->appendParagraph(pht('Are you sure you want to log out?'))
->addCancelButton('/');
$configs = id(new PhabricatorAuthProviderConfigQuery())
->setViewer(PhabricatorUser::getOmnipotentUser())
->execute();
if (!$configs) {
$dialog
->appendRemarkup(
pht(
'WARNING: You have not configured any authentication providers '.
'yet, so your account has no login credentials. If you log out '.
'now, you will not be able to log back in normally.'))
->appendParagraph(
pht(
'To enable the login flow, follow setup guidance and configure '.
'at least one authentication provider, then associate '.
'credentials with your account. After completing these steps, '.
'you will be able to log out and log back in normally.'))
->appendParagraph(
pht(
'If you log out now, you can still regain access to your '.
'account later by using the account recovery workflow. The '.
'login screen will prompt you with recovery instructions.'));
$button = pht('Log Out Anyway');
} else {
$button = pht('Log Out');
}
$dialog->addSubmitButton($button);
return $dialog;
}
return id(new AphrontRedirectResponse())->setURI('/');

View file

@ -64,7 +64,7 @@ final class PhabricatorAuthListController
array(
'href' => $this->getApplicationURI('config/new/'),
),
pht('Add Authentication Provider'))));
pht('Add Provider'))));
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb(pht('Login and Registration'));

View file

@ -160,6 +160,20 @@ final class AphrontDialogView
return $this->appendChild($box);
}
public function appendRemarkup($remarkup) {
$viewer = $this->getViewer();
$view = new PHUIRemarkupView($viewer, $remarkup);
$view_tag = phutil_tag(
'div',
array(
'class' => 'aphront-dialog-view-paragraph',
),
$view);
return $this->appendChild($view_tag);
}
public function appendParagraph($paragraph) {
return $this->appendParagraphTag($paragraph);
}