1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-26 00:32:42 +01:00

Show the customized "Login" message on the login screen

Summary: Depends on D19992. Ref T13222. If administrators provide a custom login message, show it on the login screen.

Test Plan:
{F6137930}

  - Viewed login screen with and without a custom message.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13222

Differential Revision: https://secure.phabricator.com/D19994
This commit is contained in:
epriestley 2019-01-17 18:29:42 -08:00
parent 2c713b2d25
commit 22ad1ff2c5
5 changed files with 53 additions and 3 deletions

View file

@ -9,7 +9,7 @@ return array(
'names' => array(
'conpherence.pkg.css' => '3c8a0668',
'conpherence.pkg.js' => '020aebcf',
'core.pkg.css' => '7fa376a9',
'core.pkg.css' => 'e94cc920',
'core.pkg.js' => '5c737607',
'differential.pkg.css' => 'b8df73d4',
'differential.pkg.js' => '67c9ea4c',
@ -36,7 +36,7 @@ return array(
'rsrc/css/aphront/typeahead-browse.css' => 'b7ed02d2',
'rsrc/css/aphront/typeahead.css' => '8779483d',
'rsrc/css/application/almanac/almanac.css' => '2e050f4f',
'rsrc/css/application/auth/auth.css' => '9f6e4ed8',
'rsrc/css/application/auth/auth.css' => 'add92fd8',
'rsrc/css/application/base/main-menu-view.css' => '8e2d9a28',
'rsrc/css/application/base/notification-menu.css' => 'e6962e89',
'rsrc/css/application/base/phui-theme.css' => '35883b37',
@ -524,7 +524,7 @@ return array(
'aphront-tooltip-css' => 'e3f2412f',
'aphront-typeahead-control-css' => '8779483d',
'application-search-view-css' => '0f7c06d8',
'auth-css' => '9f6e4ed8',
'auth-css' => 'add92fd8',
'bulk-job-css' => '73af99f5',
'conduit-api-css' => 'ce2cfc41',
'config-options-css' => '16c920ae',

View file

@ -17,6 +17,7 @@ final class PhabricatorAuthLoginController
if ($parameter_name == 'code') {
return true;
}
return parent::shouldAllowRestrictedParameter($parameter_name);
}

View file

@ -194,6 +194,8 @@ final class PhabricatorAuthStartController
$invite_message = $this->renderInviteHeader($invite);
}
$custom_message = $this->newCustomStartMessage();
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb(pht('Login'));
$crumbs->setBorder(true);
@ -202,6 +204,7 @@ final class PhabricatorAuthStartController
$view = array(
$header,
$invite_message,
$custom_message,
$out,
);
@ -305,4 +308,25 @@ final class PhabricatorAuthStartController
->setURI($auto_uri);
}
private function newCustomStartMessage() {
$viewer = $this->getViewer();
$text = PhabricatorAuthMessage::loadMessageText(
$viewer,
PhabricatorAuthLoginMessageType::MESSAGEKEY);
if (!strlen($text)) {
return null;
}
$remarkup_view = new PHUIRemarkupView($viewer, $text);
return phutil_tag(
'div',
array(
'class' => 'auth-custom-message',
),
$remarkup_view);
}
}

View file

@ -61,6 +61,22 @@ final class PhabricatorAuthMessage
return $this->getMessageType()->getDisplayName();
}
public static function loadMessageText(
PhabricatorUser $viewer,
$message_key) {
$message = id(new PhabricatorAuthMessageQuery())
->setViewer($viewer)
->withMessageKeys(array($message_key))
->executeOne();
if (!$message) {
return null;
}
return $message->getMessageText();
}
/* -( PhabricatorPolicyInterface )----------------------------------------- */

View file

@ -55,3 +55,12 @@
.auth-account-view-account-uri {
word-break: break-word;
}
.auth-custom-message {
margin: 32px auto 64px;
max-width: 548px;
background: #fff;
padding: 16px;
border: 1px solid {$lightblueborder};
border-radius: 4px;
}