Commit 94646487 authored by Regan Hsu's avatar Regan Hsu Committed by Commit Bot

[CrOS Settings] Disable 'confirm' button when password is being checked.

Currently, the confirm button is not disabled while the password is being
checked,serving a confusing experience as users can repeatedly hit the confirm
button without a visual ack that the password is being checked.  This CL
disables the confirm button while the password is being checked.

Bug: 999475
Change-Id: I907017dd1f7bfdf4cff318b0621d730b113200bd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1888150
Commit-Queue: Regan Hsu <hsuregan@chromium.org>
Reviewed-by: default avatarSteven Bennetts <stevenjb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#710577}
parent 10d377be
...@@ -39,7 +39,8 @@ ...@@ -39,7 +39,8 @@
</cr-button> </cr-button>
<cr-button id="confirmButton" class="action-button" <cr-button id="confirmButton" class="action-button"
disabled$="[[!isConfirmEnabled_(inputValue_, passwordInvalid_)]]" disabled$="[[!isConfirmEnabled_(inputValue_, passwordInvalid_,
waitingForPasswordCheck_)]]"
on-click="submitPassword_"> on-click="submitPassword_">
$i18n{confirm} $i18n{confirm}
</cr-button> </cr-button>
......
...@@ -71,6 +71,12 @@ Polymer({ ...@@ -71,6 +71,12 @@ Polymer({
* @type {QuickUnlockPrivate} * @type {QuickUnlockPrivate}
*/ */
quickUnlockPrivate: {type: Object, value: chrome.quickUnlockPrivate}, quickUnlockPrivate: {type: Object, value: chrome.quickUnlockPrivate},
/** @private {boolean} */
waitingForPasswordCheck_: {
type: Boolean,
value: false,
},
}, },
/** @return {!CrInputElement} */ /** @return {!CrInputElement} */
...@@ -109,6 +115,7 @@ Polymer({ ...@@ -109,6 +115,7 @@ Polymer({
* @private * @private
*/ */
submitPassword_: function() { submitPassword_: function() {
this.waitingForPasswordCheck_ = true;
clearTimeout(this.clearAccountPasswordTimeoutId_); clearTimeout(this.clearAccountPasswordTimeoutId_);
const password = this.passwordInput.value; const password = this.passwordInput.value;
...@@ -116,10 +123,12 @@ Polymer({ ...@@ -116,10 +123,12 @@ Polymer({
// Do not submit/show an error in this case. // Do not submit/show an error in this case.
if (!password) { if (!password) {
this.passwordInvalid_ = false; this.passwordInvalid_ = false;
this.waitingForPasswordCheck_ = false;
return; return;
} }
this.quickUnlockPrivate.getAuthToken(password, (tokenInfo) => { this.quickUnlockPrivate.getAuthToken(password, (tokenInfo) => {
this.waitingForPasswordCheck_ = false;
if (chrome.runtime.lastError) { if (chrome.runtime.lastError) {
this.passwordInvalid_ = true; this.passwordInvalid_ = true;
// Select the whole password if user entered an incorrect password. // Select the whole password if user entered an incorrect password.
...@@ -154,7 +163,8 @@ Polymer({ ...@@ -154,7 +163,8 @@ Polymer({
/** @private */ /** @private */
isConfirmEnabled_: function() { isConfirmEnabled_: function() {
return !this.passwordInvalid_ && this.inputValue_; return !this.waitingForPasswordCheck_ && !this.passwordInvalid_ &&
this.inputValue_;
}, },
}); });
})(); })();
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment