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));
28 * Screen controls in bottom strip.
29 * @type {Array.<HTMLButtonElement>} Buttons to be put in the bottom strip.
34 var confirmButton = this.ownerDocument.createElement('button');
35 confirmButton.textContent =
36 loadTimeData.getString('confirmPasswordConfirmButton');
37 confirmButton.addEventListener('click',
38 this.onConfirmPassword_.bind(this));
39 buttons.push(confirmButton);
44 get defaultControl() {
45 return $('confirm-password-input');
49 * Handle 'keydown' event on password input field.
51 onPasswordFieldKeyDown_: function(e) {
52 if (e.keyIdentifier == 'Enter')
53 this.onConfirmPassword_();
57 * Invoked when user clicks on the 'confirm' button.
59 onConfirmPassword_: function() {
60 this.callback_($('confirm-password-input').value);
64 * Shows the confirm password screen.
65 * @param {function(string)} callback The callback to be invoked when the
66 * screen is dismissed.
68 show: function(callback) {
69 this.callback_ = callback;
71 $('confirm-password-input').value = '';
72 Oobe.showScreen({id: SCREEN_CONFIRM_PASSWORD});
73 $('progress-dots').hidden = true;