Skip to content

Commit 633aa52

Browse files
author
epriestley
committedOct 25, 2019
Persist login instructions onto flow-specific login pages (username/password and LDAP)
Summary: Fixes T13433. Currently, "Login Screen Instructions" in "Auth" are shown only on the main login screen. If you enter a bad password or bad LDAP credential set and move to the flow-specific login failure screen (for example, "invalid password"), the instructions vanish. Instead, persist them. There are reasonable cases where this is highly useful and the cases which spring to mind where this is possibly misleading are fairly easy to fix by making the instructions more specific. Test Plan: - Configured login instructions in "Auth". - Viewed main login screen, saw instructions. - Entered a bad username/password and a bad LDAP credential set, got kicked to workflow sub-pages and still saw instructions (previously: no instructions). - Grepped for other callers to `buildProviderPageResponse()` to look for anything weird, came up empty. Maniphest Tasks: T13433 Differential Revision: https://secure.phabricator.com/D20863
1 parent 5b36f0c commit 633aa52

File tree

5 files changed

+35
-28
lines changed

5 files changed

+35
-28
lines changed
 

‎resources/celerity/map.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
'names' => array(
1010
'conpherence.pkg.css' => '3c8a0668',
1111
'conpherence.pkg.js' => '020aebcf',
12-
'core.pkg.css' => '88366522',
12+
'core.pkg.css' => '686ae87c',
1313
'core.pkg.js' => '6e5c894f',
1414
'differential.pkg.css' => '607c84be',
1515
'differential.pkg.js' => 'a0212a0b',
@@ -36,7 +36,7 @@
3636
'rsrc/css/aphront/typeahead-browse.css' => 'b7ed02d2',
3737
'rsrc/css/aphront/typeahead.css' => '8779483d',
3838
'rsrc/css/application/almanac/almanac.css' => '2e050f4f',
39-
'rsrc/css/application/auth/auth.css' => 'add92fd8',
39+
'rsrc/css/application/auth/auth.css' => 'c2f23d74',
4040
'rsrc/css/application/base/main-menu-view.css' => '17b71bbc',
4141
'rsrc/css/application/base/notification-menu.css' => '4df1ee30',
4242
'rsrc/css/application/base/phui-theme.css' => '35883b37',
@@ -540,7 +540,7 @@
540540
'aphront-tooltip-css' => 'e3f2412f',
541541
'aphront-typeahead-control-css' => '8779483d',
542542
'application-search-view-css' => '0f7c06d8',
543-
'auth-css' => 'add92fd8',
543+
'auth-css' => 'c2f23d74',
544544
'bulk-job-css' => '73af99f5',
545545
'conduit-api-css' => 'ce2cfc41',
546546
'config-options-css' => '16c920ae',

‎src/applications/auth/controller/PhabricatorAuthController.php

+22
Original file line numberDiff line numberDiff line change
@@ -286,4 +286,26 @@ protected function renderInviteHeader(PhabricatorAuthInvite $invite) {
286286
->appendChild($invite_list);
287287
}
288288

289+
290+
final protected function newCustomStartMessage() {
291+
$viewer = $this->getViewer();
292+
293+
$text = PhabricatorAuthMessage::loadMessageText(
294+
$viewer,
295+
PhabricatorAuthLoginMessageType::MESSAGEKEY);
296+
297+
if (!strlen($text)) {
298+
return null;
299+
}
300+
301+
$remarkup_view = new PHUIRemarkupView($viewer, $text);
302+
303+
return phutil_tag(
304+
'div',
305+
array(
306+
'class' => 'auth-custom-message',
307+
),
308+
$remarkup_view);
309+
}
310+
289311
}

‎src/applications/auth/controller/PhabricatorAuthLoginController.php

+9-3
Original file line numberDiff line numberDiff line change
@@ -238,18 +238,24 @@ public function buildProviderPageResponse(
238238
$content) {
239239

240240
$crumbs = $this->buildApplicationCrumbs();
241+
$viewer = $this->getViewer();
241242

242-
if ($this->getRequest()->getUser()->isLoggedIn()) {
243+
if ($viewer->isLoggedIn()) {
243244
$crumbs->addTextCrumb(pht('Link Account'), $provider->getSettingsURI());
244245
} else {
245-
$crumbs->addTextCrumb(pht('Log In'), $this->getApplicationURI('start/'));
246+
$crumbs->addTextCrumb(pht('Login'), $this->getApplicationURI('start/'));
247+
248+
$content = array(
249+
$this->newCustomStartMessage(),
250+
$content,
251+
);
246252
}
247253

248254
$crumbs->addTextCrumb($provider->getProviderName());
249255
$crumbs->setBorder(true);
250256

251257
return $this->newPage()
252-
->setTitle(pht('Log In'))
258+
->setTitle(pht('Login'))
253259
->setCrumbs($crumbs)
254260
->appendChild($content);
255261
}

‎src/applications/auth/controller/PhabricatorAuthStartController.php

-21
Original file line numberDiff line numberDiff line change
@@ -298,27 +298,6 @@ private function tryAutoLogin(array $providers) {
298298
->setURI($auto_uri);
299299
}
300300

301-
private function newCustomStartMessage() {
302-
$viewer = $this->getViewer();
303-
304-
$text = PhabricatorAuthMessage::loadMessageText(
305-
$viewer,
306-
PhabricatorAuthLoginMessageType::MESSAGEKEY);
307-
308-
if (!strlen($text)) {
309-
return null;
310-
}
311-
312-
$remarkup_view = new PHUIRemarkupView($viewer, $text);
313-
314-
return phutil_tag(
315-
'div',
316-
array(
317-
'class' => 'auth-custom-message',
318-
),
319-
$remarkup_view);
320-
}
321-
322301
private function newEmailLoginView(array $configs) {
323302
assert_instances_of($configs, 'PhabricatorAuthProviderConfig');
324303

‎webroot/rsrc/css/application/auth/auth.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
}
5858

5959
.auth-custom-message {
60-
margin: 32px auto 64px;
60+
margin: 32px auto 48px;
6161
max-width: 548px;
6262
background: #fff;
6363
padding: 16px;

0 commit comments

Comments
 (0)
Failed to load comments.