Index: chrome/browser/resources/chromeos/login/screen_confirm_password.js |
diff --git a/chrome/browser/resources/chromeos/login/screen_confirm_password.js b/chrome/browser/resources/chromeos/login/screen_confirm_password.js |
index 2ca191ff29654d5fca5fed16279f5fbff1d10345..0b1c8e2ff69324de9e69b9abe816af2341904cb1 100644 |
--- a/chrome/browser/resources/chromeos/login/screen_confirm_password.js |
+++ b/chrome/browser/resources/chromeos/login/screen_confirm_password.js |
@@ -24,18 +24,42 @@ login.createScreen('ConfirmPasswordScreen', 'confirm-password', function() { |
'keydown', this.onPasswordFieldKeyDown_.bind(this)); |
$('confirm-password-confirm-button').addEventListener( |
'click', this.onConfirmPassword_.bind(this)); |
+ |
+ $('saml-confirm-password').addEventListener('cancel', function(e) { |
+ Oobe.showScreen({id: SCREEN_ACCOUNT_PICKER}); |
+ Oobe.resetSigninUI(true); |
+ }); |
+ $('saml-confirm-password').addEventListener('passwordEnter', function(e) { |
+ this.callback_(e.detail.password); |
+ }.bind(this)); |
}, |
get defaultControl() { |
return $('confirm-password-input'); |
}, |
+ get isNewGaiaFlow() { |
+ return document.querySelector('.new-gaia-flow') != undefined; |
+ }, |
+ |
/** @override */ |
onBeforeShow: function(data) { |
$('login-header-bar').signinUIState = |
SIGNIN_UI_STATE.SAML_PASSWORD_CONFIRM; |
}, |
+ /** @override */ |
+ onAfterShow: function(data) { |
+ if (this.isNewGaiaFlow) |
+ $('saml-confirm-password').focus(); |
+ }, |
+ |
+ /** @override */ |
+ onBeforeHide: function() { |
+ if (this.isNewGaiaFlow) |
+ $('saml-confirm-password').reset(); |
+ }, |
+ |
/** |
* Handle 'keydown' event on password input field. |
*/ |
@@ -53,15 +77,25 @@ login.createScreen('ConfirmPasswordScreen', 'confirm-password', function() { |
/** |
* Shows the confirm password screen. |
+ * @param {string} email The authenticated user's e-mail. |
* @param {number} attemptCount Number of attempts tried, starting at 0. |
* @param {function(string)} callback The callback to be invoked when the |
* screen is dismissed. |
*/ |
- show: function(attemptCount, callback) { |
+ show: function(email, attemptCount, callback) { |
this.callback_ = callback; |
this.classList.toggle('error', attemptCount > 0); |
- |
- $('confirm-password-input').value = ''; |
+ if (this.isNewGaiaFlow) { |
+ $('saml-confirm-password-contents').hidden = true; |
+ var samlConfirmPassword = $('saml-confirm-password'); |
+ samlConfirmPassword.reset(); |
+ samlConfirmPassword.hidden = false; |
+ samlConfirmPassword.email = email; |
+ if (attemptCount > 0) |
+ samlConfirmPassword.invalidate(); |
+ } else { |
+ $('confirm-password-input').value = ''; |
+ } |
Oobe.showScreen({id: SCREEN_CONFIRM_PASSWORD}); |
$('progress-dots').hidden = true; |
} |