Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Side by Side Diff: chrome/browser/resources/chromeos/login/screen_confirm_password.js

Issue 137803008: cros: Update SAML flow. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: split gaia.css Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @fileoverview Password confirmation screen implementation. 6 * @fileoverview Password confirmation screen implementation.
7 */ 7 */
8 8
9 login.createScreen('ConfirmPasswordScreen', 'confirm-password', function() { 9 login.createScreen('ConfirmPasswordScreen', 'confirm-password', function() {
10 return { 10 return {
11 EXTERNAL_API: [ 11 EXTERNAL_API: [
12 'show' 12 'show'
13 ], 13 ],
14 14
15 /** 15 /**
16 * Callback to run when the screen is dismissed. 16 * Callback to run when the screen is dismissed.
17 * @type {function(string)} 17 * @type {function(string)}
18 */ 18 */
19 callback_: null, 19 callback_: null,
20 20
21 /** @override */ 21 /** @override */
22 decorate: function() { 22 decorate: function() {
23 $('confirm-password-input').addEventListener( 23 $('confirm-password-input').addEventListener(
24 'keydown', this.onPasswordFieldKeyDown_.bind(this)); 24 'keydown', this.onPasswordFieldKeyDown_.bind(this));
25 }, 25 $('confirm-password-confirm-button').addEventListener(
26 26 'click', this.onConfirmPassword_.bind(this));
27 /**
28 * Screen controls in bottom strip.
29 * @type {Array.<HTMLButtonElement>} Buttons to be put in the bottom strip.
30 */
31 get buttons() {
32 var buttons = [];
33
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);
40
41 return buttons;
42 }, 27 },
43 28
44 get defaultControl() { 29 get defaultControl() {
45 return $('confirm-password-input'); 30 return $('confirm-password-input');
46 }, 31 },
47 32
33 /** @override */
34 onBeforeShow: function(data) {
35 $('login-header-bar').signinUIState =
36 SIGNIN_UI_STATE.SAML_PASSWORD_CONFIRM;
37 },
38
48 /** 39 /**
49 * Handle 'keydown' event on password input field. 40 * Handle 'keydown' event on password input field.
50 */ 41 */
51 onPasswordFieldKeyDown_: function(e) { 42 onPasswordFieldKeyDown_: function(e) {
52 if (e.keyIdentifier == 'Enter') 43 if (e.keyIdentifier == 'Enter')
53 this.onConfirmPassword_(); 44 this.onConfirmPassword_();
54 }, 45 },
55 46
56 /** 47 /**
57 * Invoked when user clicks on the 'confirm' button. 48 * Invoked when user clicks on the 'confirm' button.
58 */ 49 */
59 onConfirmPassword_: function() { 50 onConfirmPassword_: function() {
60 this.callback_($('confirm-password-input').value); 51 this.callback_($('confirm-password-input').value);
61 }, 52 },
62 53
63 /** 54 /**
64 * Shows the confirm password screen. 55 * Shows the confirm password screen.
56 * @param {number} attemptCount Number of attempts tried, starting at 0.
65 * @param {function(string)} callback The callback to be invoked when the 57 * @param {function(string)} callback The callback to be invoked when the
66 * screen is dismissed. 58 * screen is dismissed.
67 */ 59 */
68 show: function(callback) { 60 show: function(attemptCount, callback) {
69 this.callback_ = callback; 61 this.callback_ = callback;
62 this.classList.toggle('error', attemptCount > 0);
70 63
71 $('confirm-password-input').value = ''; 64 $('confirm-password-input').value = '';
72 Oobe.showScreen({id: SCREEN_CONFIRM_PASSWORD}); 65 Oobe.showScreen({id: SCREEN_CONFIRM_PASSWORD});
73 $('progress-dots').hidden = true; 66 $('progress-dots').hidden = true;
74 } 67 }
75 }; 68 };
76 }); 69 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698