Skip to content

Commit

Permalink
ChromeOS Gaia: SAML password confirmation dialog
Browse files Browse the repository at this point in the history
Known issues:
-Cancel confirmation dialog and backdrop style should be according to crbug/482962
-Cancel confirmation dialog doesn't cover "account creation" case
-Fatal error does not use 'notification-card' element.

BUG=467119,469428
TEST=Manual
TBR=grt@chromium.org

Review URL: https://codereview.chromium.org/1115993002

Cr-Commit-Position: refs/heads/master@{#329243}
  • Loading branch information
rsorokin authored and Commit bot committed May 11, 2015
1 parent e5cc32e commit 3d1921c
Show file tree
Hide file tree
Showing 25 changed files with 296 additions and 44 deletions.
18 changes: 18 additions & 0 deletions chrome/app/chromeos_strings.grdp
Original file line number Diff line number Diff line change
Expand Up @@ -1593,9 +1593,18 @@ Press any key to continue exploring.
<message name="IDS_LOGIN_CONFIRM_PASSWORD_TITLE" desc="Title for the confirm password dialog.">
Complete sign-in
</message>
<message name="IDS_LOGIN_CONFIRM_PASSWORD_TITLE_NEW_GAIA_FLOW" desc="Title for the confirm password dialog.">
Please re-enter your password to update your Chromebook profile.
</message>
<message name="IDS_LOGIN_CONFIRM_PASSWORD_LABEL" desc="Label for the password field on the confirm password dialog.">
Please re-enter your password
</message>
<message name="IDS_LOGIN_CONFIRM_PASSWORD_LABEL_NEW_GAIA_FLOW" desc="Label for the password field on the confirm password dialog.">
Confirm your password
</message>
<message name="IDS_LOGIN_CONFIRM_PASSWORD_INCORRECT_PASSWORD" desc="Error that is shown when incorrect password was supplied.">
Incorrect password
</message>
<message name="IDS_LOGIN_CONFIRM_PASSWORD_CONFIRM_BUTTON" desc="Label for the confirm button on the confirm password dialog.">
Confirm
</message>
Expand All @@ -1605,6 +1614,15 @@ Press any key to continue exploring.
<message name="IDS_LOGIN_CONFIRM_PASSWORD_ERROR_TEXT" desc="Error text to show when the password typed by the user could not be verified.">
Sorry, your password could not be verified. Please try again.
</message>
<message name="IDS_LOGIN_ACCOUNT_SETUP_CANCEL_DIALOG_TITLE" desc="Text to show in confirmation cancel dialog.">
Cancel account setup?
</message>
<message name="IDS_LOGIN_ACCOUNT_SETUP_CANCEL_DIALOG_NO" desc="Text to show on button to decline cancelation.">
No
</message>
<message name="IDS_LOGIN_ACCOUNT_SETUP_CANCEL_DIALOG_YES" desc="Text to show on button to accept cancelation.">
Yes
</message>
<message name="IDS_LOGIN_FATAL_ERROR_NO_ACCOUNT_DETAILS" desc="Message to show when the authentication could not be completed because the user's account details could not be retrieved.">
Oops, couldn't sign you in. Sign-in failed because your account details could not be retrieved.
</message>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
<include src="gaia_header.html">
<include src="offline_gaia.html">
<include src="gaia_password_changed.html">
<include src="saml_confirm_password.html">

<script src="chrome://oobe/custom_elements.js"></script>
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
<include src="gaia_input_form.js">
<include src="offline_gaia.js">
<include src="gaia_password_changed.js">
<include src="saml_confirm_password.js">
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<include src="gaia_header.html">
<include src="offline_gaia.html">
<include src="gaia_password_changed.html">
<include src="saml_confirm_password.html">
<include src="notification_card.html">

<script src="chrome://oobe/custom_elements.js"></script>
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@
<include src="gaia_input_form.js">
<include src="offline_gaia.js">
<include src="gaia_password_changed.js">
<include src="saml_confirm_password.js">
<include src="notification_card.js">
4 changes: 2 additions & 2 deletions chrome/browser/resources/chromeos/login/gaia_buttons.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@

Polymer('gaia-paper-button', {
onKeyDown: function(e) {
if (e.keyCode == 13 || e.keyCode == 32)
if (!this.disabled && (e.keyCode == 13 || e.keyCode == 32))
this.fire('tap');
}
});

Polymer('gaia-core-icon-button', {
onKeyDown: function(e) {
if (e.keyCode == 13 || e.keyCode == 32)
if (!this.disabled && (e.keyCode == 13 || e.keyCode == 32))
this.fire('tap');
}
});
Expand Down
17 changes: 15 additions & 2 deletions chrome/browser/resources/chromeos/login/gaia_card.css
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@
min-width: 90px;
}

::content /deep/ .dialog-action-button {
color: rgb(66, 133, 244);
}

::content /deep/ .dialog-action-button:focus {
background: rgb(217, 221, 234);
}

::content /deep/ .link-button {
color: rgb(66, 133, 244);
font-size: 14px;
Expand All @@ -53,7 +61,11 @@
padding: 0;
}

::content /deep/ p.gaia-body-text {
::content /deep/ div.gaia-body-text {
margin-bottom: 24px;
}

::content /deep/ div.gaia-body-text p {
color: rgba(0, 0, 0, 0.87);
font-size: 14px;
line-height: 20px;
Expand All @@ -74,7 +86,7 @@
margin-bottom: 0;
}

#bottom-overlay {
.overlay {
background-color: rgba(0, 0, 0, 0.5);
display: none;
height: 100%;
Expand All @@ -94,6 +106,7 @@
background-color: rgb(255, 184, 9);
}

:host(.full-disabled) #full-overlay,
:host(.disabled) #bottom-overlay,
:host(.disabled) #progress-bar {
display: block;
Expand Down
4 changes: 3 additions & 1 deletion chrome/browser/resources/chromeos/login/gaia_card.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@
<div class="footer-container" flex vertical layout>
<content select=".footer"></content>
</div>
<div id="bottom-overlay">
<div id="bottom-overlay" class="overlay">
</div>
</div>
<div id="full-overlay" class="overlay">
</div>
</template>
</polymer-element>
2 changes: 1 addition & 1 deletion chrome/browser/resources/chromeos/login/gaia_input.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Polymer('gaia-input', (function() {

domainChanged: function() {
this.setDomainVisibility();
}
},
};
})());

9 changes: 8 additions & 1 deletion chrome/browser/resources/chromeos/login/gaia_input_form.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ Polymer('gaia-input-form', (function() {
onKeyDown: function(e) {
if (e.keyCode == 13 && !this.$.button.disabled)
this.onButtonClicked();
}
},

set disabled(value) {
var controls = this.querySelectorAll(
':host /deep/ [role="button"], :host /deep/ [is="core-input"]');
for (var i = 0, control; control = controls[i]; ++i)
control.disabled = value;
},
};
})());
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,3 @@ core-icon[icon='warning'] {
left: 0;
right: auto;
}

div.margined {
margin-bottom: 24px;
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,8 @@
<gaia-card id="oldPasswordCard">
<gaia-header class="header" email="{{email}}">
</gaia-header>
<div horizontal layout center class="footer margined">
<p class="gaia-body-text"
i18n-content="passwordChangedTitle">
<div horizontal layout center class="footer gaia-body-text">
<p i18n-content="passwordChangedTitle">
</p>
</div>
<gaia-input-form class="footer" id="oldPasswordInput"
Expand All @@ -65,10 +64,9 @@
<gaia-header class="header" email="{{email}}">
</gaia-header>
<div class="footer">
<div horizontal layout center class="margined">
<div horizontal layout center class="gaia-body-text">
<core-icon icon="warning"></core-icon>
<p flex class="gaia-body-text"
i18n-content="passwordChangedProceedAnywayTitle">
<p flex i18n-content="passwordChangedProceedAnywayTitle">
</p>
</div>
<div horizontal layout justified center>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,7 @@ Polymer('gaia-password-changed', {
},

set disabled(value) {
var controls = this.$.animatedPages.querySelectorAll(
':host /deep/ .footer /deep/ [role="button"]');
for (var i = 0, control; control = controls[i]; ++i) {
control.disabled = value;
}
this.$.oldPasswordInput.disabled = value;
},

onForgotPasswordClicked: function() {
Expand Down
7 changes: 7 additions & 0 deletions chrome/browser/resources/chromeos/login/login_common.js
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,13 @@ cr.define('cr.ui', function() {
Oobe.getInstance().setClientAreaSize(width, height);
};

/**
* Checks whether the New Gaia flow is active.
*/
Oobe.isNewGaiaFlow = function() {
return document.querySelector('.new-gaia-flow') != undefined;
};

// Export
return {
Oobe: Oobe
Expand Down
22 changes: 22 additions & 0 deletions chrome/browser/resources/chromeos/login/saml_confirm_password.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/* Copyright 2015 The Chromium Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/

#closeButton {
color: rgb(255, 255, 255);
position: absolute;
right: 0;
top: 0;
z-index: 1;
}

:host-context(html[dir=rtl]) #closeButton {
left: 0;
right: auto;
}

#cancelConfirmDlg {
position: absolute;
width: 384px;
}
75 changes: 75 additions & 0 deletions chrome/browser/resources/chromeos/login/saml_confirm_password.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<link rel="import" href="chrome://resources/polymer/polymer/polymer.html">
<link rel="import" href="chrome://resources/polymer/polymer/layout.html">
<link rel="import" href="chrome://resources/polymer/core-animated-pages/core-animated-pages.html">
<link rel="import" href="chrome://resources/polymer/core-animated-pages/transitions/cross-fade.html">

<!--
SAML password confirmation UI for the New Gaia flow.
Contains two cards with a fade transition between them:
1. Password input form.
2. Spinner with notice "Please wait";
Example:
<saml-confirm-password id="saml-confirm-password" hidden>
</saml-confirm-password>
Attributes:
'email' - Displayed email in header.
Events:
'passwordEnter' - Fired when user enters password. Fires with an argument
|password|.
'cancel' - Fired when user presses the X-button and then presses YES
in the cancel confirmation dialog.
Methods:
'invalidate' - Mark password input as invalid.
'reset' - Reset element, switches to the first screen, closes
the confirm dialog, displays the close button,
empties password field and enables buttons.
'focus' - If the current card is the first one, focuses password input.
-->
<polymer-element name="saml-confirm-password" vertical layout
attributes="email">
<template>
<link rel="stylesheet" href="saml_confirm_password.css">
<gaia-core-icon-button id="closeButton" icon="close" on-tap="{{onClose}}">
</gaia-core-icon-button>
<core-animated-pages id="animatedPages" transitions="cross-fade-all" flex
on-core-animated-pages-transition-end="{{onTransitionEnd}}">
<section flex>
<gaia-card id="confirmPasswordCard">
<gaia-header class="header" email="{{email}}">
</gaia-header>
<div horizontal layout center class="footer gaia-body-text">
<p i18n-content="confirmPasswordTitle">
</p>
</div>
<gaia-input-form id="inputForm" class="footer"
on-submit="{{onPasswordSubmitted}}"
i18n-values="buttonText:nextButtonText">
<gaia-input id="passwordInput" type="password" required
i18n-values="error:confirmPasswordIncorrectPassword;
label:confirmPasswordLabel;">
</gaia-input>
</gaia-input-form>
<paper-action-dialog class="footer" id="cancelConfirmDlg"
layered="false">
<p i18n-content="accountSetupCancelDialogTitle"></p>
<gaia-paper-button class="dialog-action-button" affirmative
autofocus i18n-content="accountSetupCancelDialogNo">
</gaia-paper-button>
<gaia-paper-button id="confirmCancel" on-tap="{{onConfirmCancel}}"
class="dialog-action-button" affirmative
i18n-content="accountSetupCancelDialogYes">
</gaia-paper-button>
</paper-action-dialog>
</gaia-card>
</section>
<section flex vertical layout center-justified>
<throbber-notice i18n-values="text:gaiaLoadingNewGaia" self-center>
</throbber-notice>
</section>
</core-animated-pages>
</template>
</polymer-element>
57 changes: 57 additions & 0 deletions chrome/browser/resources/chromeos/login/saml_confirm_password.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/* Copyright 2015 The Chromium Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/

Polymer('saml-confirm-password', {
onClose: function() {
this.disabled = true;
this.$.cancelConfirmDlg.toggle();
},

onConfirmCancel: function() {
this.fire('cancel');
},

reset: function() {
this.$.cancelConfirmDlg.close();
this.disabled = false;
this.$.closeButton.hidden = false;
this.$.animatedPages.selected = 0;
this.$.passwordInput.value = '';
},

invalidate: function() {
this.$.passwordInput.isInvalid = true;
},

focus: function() {
if (this.$.animatedPages.selected == 0)
this.$.passwordInput.focus();
},

onPasswordSubmitted: function() {
var inputPassword = this.$.passwordInput.value;
this.$.passwordInput.value = '';
if (!inputPassword) {
this.invalidate();
} else {
this.$.animatedPages.selected += 1;
this.$.closeButton.hidden = true;
this.fire('passwordEnter', {password: inputPassword});
}
},

set disabled(value) {
this.$.confirmPasswordCard.classList.toggle('full-disabled', value);
this.$.inputForm.disabled = value;
this.$.closeButton.disabled = value;
},

ready: function() {
this.$.cancelConfirmDlg.addEventListener('core-overlay-close-completed',
function() {
this.disabled = false;
}.bind(this));
}
});
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,15 @@
margin-top: 1em;
}

.confirm-password .new-gaia-flow #step-logo {
display: none;
}

.new-gaia-flow #saml-confirm-password,
.new-gaia-flow #confirm-password {
height: 528px;
padding: 0;
width: 448px;
}

<include src="gaia.css">
Loading

0 comments on commit 3d1921c

Please sign in to comment.