Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 1156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1167 (Oobe.getInstance().displayType == DISPLAY_TYPE.USER_ADDING); | 1167 (Oobe.getInstance().displayType == DISPLAY_TYPE.USER_ADDING); |
| 1168 return isMultiProfilesUI && !this.user_.isMultiProfilesAllowed; | 1168 return isMultiProfilesUI && !this.user_.isMultiProfilesAllowed; |
| 1169 }, | 1169 }, |
| 1170 | 1170 |
| 1171 /** | 1171 /** |
| 1172 * Gets main input element. | 1172 * Gets main input element. |
| 1173 * @type {(HTMLButtonElement|HTMLInputElement)} | 1173 * @type {(HTMLButtonElement|HTMLInputElement)} |
| 1174 */ | 1174 */ |
| 1175 get mainInput() { | 1175 get mainInput() { |
| 1176 if (this.isAuthTypePassword) { | 1176 if (this.isAuthTypePassword) { |
| 1177 if (this.pinContainer.classList.contains('pin-enabled')) { | |
| 1178 return this.pinKeyboard.inputElement; | |
| 1179 } | |
| 1177 return this.passwordElement; | 1180 return this.passwordElement; |
| 1178 } else if (this.isAuthTypeOnlineSignIn) { | 1181 } else if (this.isAuthTypeOnlineSignIn) { |
| 1179 return this; | 1182 return this; |
| 1180 } else if (this.isAuthTypeUserClick) { | 1183 } else if (this.isAuthTypeUserClick) { |
| 1181 return this.passwordLabelElement; | 1184 return this.passwordLabelElement; |
| 1182 } | 1185 } |
| 1183 }, | 1186 }, |
| 1184 | 1187 |
| 1185 /** | 1188 /** |
| 1186 * Whether action box button is in active state. | 1189 * Whether action box button is in active state. |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1333 * @return {boolean} True if activated successfully. | 1336 * @return {boolean} True if activated successfully. |
| 1334 */ | 1337 */ |
| 1335 activate: function(e) { | 1338 activate: function(e) { |
| 1336 if (this.isAuthTypeOnlineSignIn) { | 1339 if (this.isAuthTypeOnlineSignIn) { |
| 1337 this.showSigninUI(); | 1340 this.showSigninUI(); |
| 1338 } else if (this.isAuthTypeUserClick) { | 1341 } else if (this.isAuthTypeUserClick) { |
| 1339 Oobe.disableSigninUI(); | 1342 Oobe.disableSigninUI(); |
| 1340 this.classList.toggle('signing-in', true); | 1343 this.classList.toggle('signing-in', true); |
| 1341 chrome.send('attemptUnlock', [this.user.username]); | 1344 chrome.send('attemptUnlock', [this.user.username]); |
| 1342 } else if (this.isAuthTypePassword) { | 1345 } else if (this.isAuthTypePassword) { |
| 1343 if (!this.passwordElement.value) | 1346 if (!this.passwordElement.value && this.pinKeyboard.inputElement && |
| 1347 !this.pinKeyboard.inputElement.value) | |
| 1344 return false; | 1348 return false; |
| 1345 Oobe.disableSigninUI(); | 1349 Oobe.disableSigninUI(); |
| 1346 chrome.send('authenticateUser', | 1350 // The PIN gets authenticated seperately, so we do not want it to be |
| 1347 [this.user.username, this.passwordElement.value]); | 1351 // authenticated twice. |
| 1352 if (this.passwordElement.value) | |
|
jdufault
2016/07/11 18:19:54
Add {}
Can the PIN submit handler be removed so t
sammiequon
2016/07/11 22:16:25
Done.
| |
| 1353 chrome.send('authenticateUser', | |
| 1354 [this.user.username, this.passwordElement.value]); | |
| 1348 } else { | 1355 } else { |
| 1349 console.error('Activating user pod with invalid authentication type: ' + | 1356 console.error('Activating user pod with invalid authentication type: ' + |
| 1350 this.authType); | 1357 this.authType); |
| 1351 } | 1358 } |
| 1352 | 1359 |
| 1353 return true; | 1360 return true; |
| 1354 }, | 1361 }, |
| 1355 | 1362 |
| 1356 showSupervisedUserSigninWarning: function() { | 1363 showSupervisedUserSigninWarning: function() { |
| 1357 // Legacy supervised user token has been invalidated. | 1364 // Legacy supervised user token has been invalidated. |
| (...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1796 if (this.parentNode.disabled) | 1803 if (this.parentNode.disabled) |
| 1797 return; | 1804 return; |
| 1798 | 1805 |
| 1799 if (!this.isActionBoxMenuActive) { | 1806 if (!this.isActionBoxMenuActive) { |
| 1800 if (this.isAuthTypeOnlineSignIn) { | 1807 if (this.isAuthTypeOnlineSignIn) { |
| 1801 this.showSigninUI(); | 1808 this.showSigninUI(); |
| 1802 } else if (this.isAuthTypeUserClick && this.userClickAuthAllowed_) { | 1809 } else if (this.isAuthTypeUserClick && this.userClickAuthAllowed_) { |
| 1803 // Note that this.userClickAuthAllowed_ is set in mouse down event | 1810 // Note that this.userClickAuthAllowed_ is set in mouse down event |
| 1804 // handler. | 1811 // handler. |
| 1805 this.parentNode.setActivatedPod(this); | 1812 this.parentNode.setActivatedPod(this); |
| 1813 } else if (this.pinKeyboard.submitButton && | |
| 1814 e.target == this.pinKeyboard.submitButton) { | |
| 1815 this.parentNode.setActivatedPod(this); | |
| 1806 } | 1816 } |
| 1807 | 1817 |
| 1808 if (this.multiProfilesPolicyApplied) | 1818 if (this.multiProfilesPolicyApplied) |
| 1809 this.userTypeBubbleElement.classList.add('bubble-shown'); | 1819 this.userTypeBubbleElement.classList.add('bubble-shown'); |
| 1810 | 1820 |
| 1811 // Prevent default so that we don't trigger 'focus' event and | 1821 // Prevent default so that we don't trigger 'focus' event and |
| 1812 // stop propagation so that the 'click' event does not bubble | 1822 // stop propagation so that the 'click' event does not bubble |
| 1813 // up and accidentally closes the bubble tooltip. | 1823 // up and accidentally closes the bubble tooltip. |
| 1814 stopEventPropagation(e); | 1824 stopEventPropagation(e); |
| 1815 } | 1825 } |
| (...skipping 1576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3392 else | 3402 else |
| 3393 this.focusPod(this.firstElementChild); | 3403 this.focusPod(this.firstElementChild); |
| 3394 | 3404 |
| 3395 e.stopPropagation(); | 3405 e.stopPropagation(); |
| 3396 } | 3406 } |
| 3397 break; | 3407 break; |
| 3398 case 'Enter': | 3408 case 'Enter': |
| 3399 if (this.focusedPod_) { | 3409 if (this.focusedPod_) { |
| 3400 var targetTag = e.target.tagName; | 3410 var targetTag = e.target.tagName; |
| 3401 if (e.target == this.focusedPod_.passwordElement || | 3411 if (e.target == this.focusedPod_.passwordElement || |
| 3412 e.target == this.focusedPod_.pinKeyboard.inputElement || | |
| 3402 (targetTag != 'INPUT' && | 3413 (targetTag != 'INPUT' && |
| 3403 targetTag != 'BUTTON' && | 3414 targetTag != 'BUTTON' && |
| 3404 targetTag != 'A')) { | 3415 targetTag != 'A')) { |
| 3405 this.setActivatedPod(this.focusedPod_, e); | 3416 this.setActivatedPod(this.focusedPod_, e); |
| 3406 e.stopPropagation(); | 3417 e.stopPropagation(); |
| 3407 } | 3418 } |
| 3408 } | 3419 } |
| 3409 break; | 3420 break; |
| 3410 case 'Escape': | 3421 case 'Escape': |
| 3411 if (!this.alwaysFocusSinglePod) | 3422 if (!this.alwaysFocusSinglePod) |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3497 if (pod && pod.multiProfilesPolicyApplied) { | 3508 if (pod && pod.multiProfilesPolicyApplied) { |
| 3498 pod.userTypeBubbleElement.classList.remove('bubble-shown'); | 3509 pod.userTypeBubbleElement.classList.remove('bubble-shown'); |
| 3499 } | 3510 } |
| 3500 } | 3511 } |
| 3501 }; | 3512 }; |
| 3502 | 3513 |
| 3503 return { | 3514 return { |
| 3504 PodRow: PodRow | 3515 PodRow: PodRow |
| 3505 }; | 3516 }; |
| 3506 }); | 3517 }); |
| OLD | NEW |