1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
6 * @fileoverview Password confirmation screen implementation.
9 login.createScreen('ConfirmPasswordScreen', 'confirm-password', function() {
16 * Callback to run when the screen is dismissed.
17 * @type {function(string)}
22 decorate: function() {
23 $('confirm-password-input').addEventListener(
24 'keydown', this.onPasswordFieldKeyDown_.bind(this));
25 $('confirm-password-confirm-button').addEventListener(
26 'click', this.onConfirmPassword_.bind(this));
29 get defaultControl() {
30 return $('confirm-password-input');
34 onBeforeShow: function(data) {
35 $('login-header-bar').signinUIState =
36 SIGNIN_UI_STATE.SAML_PASSWORD_CONFIRM;
40 * Handle 'keydown' event on password input field.
42 onPasswordFieldKeyDown_: function(e) {
43 if (e.keyIdentifier == 'Enter')
44 this.onConfirmPassword_();
48 * Invoked when user clicks on the 'confirm' button.
50 onConfirmPassword_: function() {
51 this.callback_($('confirm-password-input').value);
55 * Shows the confirm password screen.
56 * @param {number} attemptCount Number of attempts tried, starting at 0.
57 * @param {function(string)} callback The callback to be invoked when the
58 * screen is dismissed.
60 show: function(attemptCount, callback) {
61 this.callback_ = callback;
62 this.classList.toggle('error', attemptCount > 0);
64 $('confirm-password-input').value = '';
65 Oobe.showScreen({id: SCREEN_CONFIRM_PASSWORD});
66 $('progress-dots').hidden = true;