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

Side by Side Diff: ui/login/account_picker/user_pod_row.js

Issue 2131823004: Dialog message saying PIN is incorrect positioned correctly. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: Fixed patch set 4 errors. Created 4 years, 5 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
« no previous file with comments | « chrome/browser/resources/chromeos/quick_unlock/pin_keyboard.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 User pod row implementation. 6 * @fileoverview User pod row implementation.
7 */ 7 */
8 8
9 cr.define('login', function() { 9 cr.define('login', function() {
10 /** 10 /**
(...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after
741 741
742 /** 742 /**
743 * Initializes the pod after its properties set and added to a pod row. 743 * Initializes the pod after its properties set and added to a pod row.
744 */ 744 */
745 initialize: function() { 745 initialize: function() {
746 this.passwordElement.addEventListener('keydown', 746 this.passwordElement.addEventListener('keydown',
747 this.parentNode.handleKeyDown.bind(this.parentNode)); 747 this.parentNode.handleKeyDown.bind(this.parentNode));
748 this.passwordElement.addEventListener('keypress', 748 this.passwordElement.addEventListener('keypress',
749 this.handlePasswordKeyPress_.bind(this)); 749 this.handlePasswordKeyPress_.bind(this));
750 750
751 if (this.pinKeyboard) {
752 this.pinKeyboard.addEventListener('submit',
753 this.handlePinSubmitted_.bind(this));
754 }
755
756 this.imageElement.addEventListener('load', 751 this.imageElement.addEventListener('load',
757 this.parentNode.handlePodImageLoad.bind(this.parentNode, this)); 752 this.parentNode.handlePodImageLoad.bind(this.parentNode, this));
758 753
759 var initialAuthType = this.user.initialAuthType || 754 var initialAuthType = this.user.initialAuthType ||
760 AUTH_TYPE.OFFLINE_PASSWORD; 755 AUTH_TYPE.OFFLINE_PASSWORD;
761 this.setAuthType(initialAuthType, null); 756 this.setAuthType(initialAuthType, null);
762 757
763 this.userClickAuthAllowed_ = false; 758 this.userClickAuthAllowed_ = false;
764 }, 759 },
765 760
766 /** 761 /**
767 * Resets tab order for pod elements to its initial state. 762 * Resets tab order for pod elements to its initial state.
768 */ 763 */
769 resetTabOrder: function() { 764 resetTabOrder: function() {
770 // Note: the |mainInput| can be the pod itself. 765 // Note: the |mainInput| can be the pod itself.
771 this.mainInput.tabIndex = -1; 766 this.mainInput.tabIndex = -1;
772 this.tabIndex = UserPodTabOrder.POD_INPUT; 767 this.tabIndex = UserPodTabOrder.POD_INPUT;
773 }, 768 },
774 769
775 /** 770 /**
776 * Handles the user hitting 'submit' on the PIN keyboard.
777 * @param {Event} e Submit event object.
778 * @private
779 */
780 handlePinSubmitted_: function(e) {
781 var pin = e.detail.pin;
782 chrome.send('authenticateUser', [this.user.username, pin]);
783 },
784
785 /**
786 * Handles keypress event (i.e. any textual input) on password input. 771 * Handles keypress event (i.e. any textual input) on password input.
787 * @param {Event} e Keypress Event object. 772 * @param {Event} e Keypress Event object.
788 * @private 773 * @private
789 */ 774 */
790 handlePasswordKeyPress_: function(e) { 775 handlePasswordKeyPress_: function(e) {
791 // When tabbing from the system tray a tab key press is received. Suppress 776 // When tabbing from the system tray a tab key press is received. Suppress
792 // this so as not to type a tab character into the password field. 777 // this so as not to type a tab character into the password field.
793 if (e.keyCode == 9) { 778 if (e.keyCode == 9) {
794 e.preventDefault(); 779 e.preventDefault();
795 return; 780 return;
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
1181 (Oobe.getInstance().displayType == DISPLAY_TYPE.USER_ADDING); 1166 (Oobe.getInstance().displayType == DISPLAY_TYPE.USER_ADDING);
1182 return isMultiProfilesUI && !this.user_.isMultiProfilesAllowed; 1167 return isMultiProfilesUI && !this.user_.isMultiProfilesAllowed;
1183 }, 1168 },
1184 1169
1185 /** 1170 /**
1186 * Gets main input element. 1171 * Gets main input element.
1187 * @type {(HTMLButtonElement|HTMLInputElement)} 1172 * @type {(HTMLButtonElement|HTMLInputElement)}
1188 */ 1173 */
1189 get mainInput() { 1174 get mainInput() {
1190 if (this.isAuthTypePassword) { 1175 if (this.isAuthTypePassword) {
1176 if (this.pinContainer.classList.contains('pin-enabled')) {
1177 return this.pinKeyboard.inputElement;
jdufault 2016/07/11 23:31:41 nit: remove {}
sammiequon 2016/07/11 23:54:44 Done.
1178 }
1191 return this.passwordElement; 1179 return this.passwordElement;
1192 } else if (this.isAuthTypeOnlineSignIn) { 1180 } else if (this.isAuthTypeOnlineSignIn) {
1193 return this; 1181 return this;
1194 } else if (this.isAuthTypeUserClick) { 1182 } else if (this.isAuthTypeUserClick) {
1195 return this.passwordLabelElement; 1183 return this.passwordLabelElement;
1196 } 1184 }
1197 }, 1185 },
1198 1186
1199 /** 1187 /**
1200 * Whether action box button is in active state. 1188 * Whether action box button is in active state.
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
1347 * @return {boolean} True if activated successfully. 1335 * @return {boolean} True if activated successfully.
1348 */ 1336 */
1349 activate: function(e) { 1337 activate: function(e) {
1350 if (this.isAuthTypeOnlineSignIn) { 1338 if (this.isAuthTypeOnlineSignIn) {
1351 this.showSigninUI(); 1339 this.showSigninUI();
1352 } else if (this.isAuthTypeUserClick) { 1340 } else if (this.isAuthTypeUserClick) {
1353 Oobe.disableSigninUI(); 1341 Oobe.disableSigninUI();
1354 this.classList.toggle('signing-in', true); 1342 this.classList.toggle('signing-in', true);
1355 chrome.send('attemptUnlock', [this.user.username]); 1343 chrome.send('attemptUnlock', [this.user.username]);
1356 } else if (this.isAuthTypePassword) { 1344 } else if (this.isAuthTypePassword) {
1357 if (!this.passwordElement.value) 1345 if (!this.passwordElement.value && this.pinKeyboard.inputElement &&
1346 !this.pinKeyboard.inputElement.value)
jdufault 2016/07/11 23:31:41 use this.pinKeyboard.value instead of inputElement
sammiequon 2016/07/11 23:54:43 Done.
1358 return false; 1347 return false;
1359 Oobe.disableSigninUI(); 1348 Oobe.disableSigninUI();
1360 chrome.send('authenticateUser', 1349 var password = this.passwordElement.value ||
1361 [this.user.username, this.passwordElement.value]); 1350 this.pinKeyboard.inputElement.value;
jdufault 2016/07/11 23:31:40 this.pinKeyboard.value instead of pinKeyboard.inpu
sammiequon 2016/07/11 23:54:43 Done.
1351 chrome.send('authenticateUser', [this.user.username, password]);
1362 } else { 1352 } else {
1363 console.error('Activating user pod with invalid authentication type: ' + 1353 console.error('Activating user pod with invalid authentication type: ' +
1364 this.authType); 1354 this.authType);
1365 } 1355 }
1366 1356
1367 return true; 1357 return true;
1368 }, 1358 },
1369 1359
1370 showSupervisedUserSigninWarning: function() { 1360 showSupervisedUserSigninWarning: function() {
1371 // Legacy supervised user token has been invalidated. 1361 // Legacy supervised user token has been invalidated.
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
1413 this.parentNode.showSigninUI(this.user.emailAddress); 1403 this.parentNode.showSigninUI(this.user.emailAddress);
1414 } 1404 }
1415 }, 1405 },
1416 1406
1417 /** 1407 /**
1418 * Resets the input field and updates the tab order of pod controls. 1408 * Resets the input field and updates the tab order of pod controls.
1419 * @param {boolean} takeFocus If true, input field takes focus. 1409 * @param {boolean} takeFocus If true, input field takes focus.
1420 */ 1410 */
1421 reset: function(takeFocus) { 1411 reset: function(takeFocus) {
1422 this.passwordElement.value = ''; 1412 this.passwordElement.value = '';
1413 if (this.pinKeyboard.inputElement)
1414 this.pinKeyboard.value = '';
1423 this.classList.toggle('signing-in', false); 1415 this.classList.toggle('signing-in', false);
1424 if (takeFocus) { 1416 if (takeFocus) {
1425 if (!this.multiProfilesPolicyApplied) 1417 if (!this.multiProfilesPolicyApplied)
1426 this.focusInput(); // This will set a custom tab order. 1418 this.focusInput(); // This will set a custom tab order.
1427 } 1419 }
1428 else 1420 else
1429 this.resetTabOrder(); 1421 this.resetTabOrder();
1430 }, 1422 },
1431 1423
1432 /** 1424 /**
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
1810 if (this.parentNode.disabled) 1802 if (this.parentNode.disabled)
1811 return; 1803 return;
1812 1804
1813 if (!this.isActionBoxMenuActive) { 1805 if (!this.isActionBoxMenuActive) {
1814 if (this.isAuthTypeOnlineSignIn) { 1806 if (this.isAuthTypeOnlineSignIn) {
1815 this.showSigninUI(); 1807 this.showSigninUI();
1816 } else if (this.isAuthTypeUserClick && this.userClickAuthAllowed_) { 1808 } else if (this.isAuthTypeUserClick && this.userClickAuthAllowed_) {
1817 // Note that this.userClickAuthAllowed_ is set in mouse down event 1809 // Note that this.userClickAuthAllowed_ is set in mouse down event
1818 // handler. 1810 // handler.
1819 this.parentNode.setActivatedPod(this); 1811 this.parentNode.setActivatedPod(this);
1812 } else if (this.pinKeyboard.submitButton &&
1813 e.target == this.pinKeyboard.submitButton) {
1814 // Sets the pod as activated if the submit button is clicked so that
1815 // it simulates what the enter button does for the password/pin.
1816 this.parentNode.setActivatedPod(this);
1820 } 1817 }
1821 1818
1822 if (this.multiProfilesPolicyApplied) 1819 if (this.multiProfilesPolicyApplied)
1823 this.userTypeBubbleElement.classList.add('bubble-shown'); 1820 this.userTypeBubbleElement.classList.add('bubble-shown');
1824 1821
1825 // Prevent default so that we don't trigger 'focus' event and 1822 // Prevent default so that we don't trigger 'focus' event and
1826 // stop propagation so that the 'click' event does not bubble 1823 // stop propagation so that the 'click' event does not bubble
1827 // up and accidentally closes the bubble tooltip. 1824 // up and accidentally closes the bubble tooltip.
1828 stopEventPropagation(e); 1825 stopEventPropagation(e);
1829 } 1826 }
(...skipping 1576 matching lines...) Expand 10 before | Expand all | Expand 10 after
3406 else 3403 else
3407 this.focusPod(this.firstElementChild); 3404 this.focusPod(this.firstElementChild);
3408 3405
3409 e.stopPropagation(); 3406 e.stopPropagation();
3410 } 3407 }
3411 break; 3408 break;
3412 case 'Enter': 3409 case 'Enter':
3413 if (this.focusedPod_) { 3410 if (this.focusedPod_) {
3414 var targetTag = e.target.tagName; 3411 var targetTag = e.target.tagName;
3415 if (e.target == this.focusedPod_.passwordElement || 3412 if (e.target == this.focusedPod_.passwordElement ||
3413 e.target == this.focusedPod_.pinKeyboard.inputElement ||
3416 (targetTag != 'INPUT' && 3414 (targetTag != 'INPUT' &&
3417 targetTag != 'BUTTON' && 3415 targetTag != 'BUTTON' &&
3418 targetTag != 'A')) { 3416 targetTag != 'A')) {
3419 this.setActivatedPod(this.focusedPod_, e); 3417 this.setActivatedPod(this.focusedPod_, e);
3420 e.stopPropagation(); 3418 e.stopPropagation();
3421 } 3419 }
3422 } 3420 }
3423 break; 3421 break;
3424 case 'Escape': 3422 case 'Escape':
3425 if (!this.alwaysFocusSinglePod) 3423 if (!this.alwaysFocusSinglePod)
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
3511 if (pod && pod.multiProfilesPolicyApplied) { 3509 if (pod && pod.multiProfilesPolicyApplied) {
3512 pod.userTypeBubbleElement.classList.remove('bubble-shown'); 3510 pod.userTypeBubbleElement.classList.remove('bubble-shown');
3513 } 3511 }
3514 } 3512 }
3515 }; 3513 };
3516 3514
3517 return { 3515 return {
3518 PodRow: PodRow 3516 PodRow: PodRow
3519 }; 3517 };
3520 }); 3518 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/chromeos/quick_unlock/pin_keyboard.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698