Index: ui/login/account_picker/user_pod_row.js |
diff --git a/ui/login/account_picker/user_pod_row.js b/ui/login/account_picker/user_pod_row.js |
index dfb2b3ad0cbaf2df2e64bc0bd1ddeec38b5d9d37..1c7bec0c0ac08e8e2280b45f3bfb1e370c9f9c62 100644 |
--- a/ui/login/account_picker/user_pod_row.js |
+++ b/ui/login/account_picker/user_pod_row.js |
@@ -755,6 +755,10 @@ cr.define('login', function() { |
this.parentNode.handleKeyDown.bind(this.parentNode)); |
this.passwordElement.addEventListener('keypress', |
this.handlePasswordKeyPress_.bind(this)); |
+ this.passwordElement.addEventListener('input', |
+ this.handlePasswordInput_.bind(this)); |
+ this.submitButton.addEventListener('click', |
+ this.handleSubmitButtonClick_.bind(this)); |
this.imageElement.addEventListener('load', |
this.parentNode.handlePodImageLoad.bind(this.parentNode, this)); |
@@ -791,6 +795,24 @@ cr.define('login', function() { |
}, |
/** |
+ * Handles input changes on password input. |
+ * @param {Event} e Input Event object. |
+ * @private |
+ */ |
+ handlePasswordInput_: function(e) { |
+ this.submitButton.disabled = this.passwordElement.value.length <= 0; |
+ this.setErrorDisplay(false); |
+ }, |
+ |
+ /** |
+ * Handles a click event on submit button. |
+ * @param {Event} e Click event. |
+ */ |
+ handleSubmitButtonClick_: function(e) { |
+ this.parentNode.setActivatedPod(this, e); |
+ }, |
+ |
+ /** |
* Top edge margin number of pixels. |
* @type {?number} |
*/ |
@@ -868,6 +890,14 @@ cr.define('login', function() { |
}, |
/** |
+ * Gets submit button. |
+ * @type {!HTMLInputElement} |
+ */ |
+ get submitButton() { |
+ return this.querySelector('.submit-button'); |
+ }, |
+ |
+ /** |
* Gets the password label, which is used to show a message where the |
* password field is normally. |
* @type {!HTMLInputElement} |
@@ -1093,6 +1123,10 @@ cr.define('login', function() { |
} |
}, |
+ setErrorDisplay: function(visible) { |
+ this.submitButton.classList.toggle('error-shown', visible); |
+ }, |
+ |
toggleTransitions: function(enable) { |
this.classList.toggle('flying-pin-pod', enable); |
}, |
@@ -2542,11 +2576,28 @@ cr.define('login', function() { |
userPod.initialize(); |
}, |
+ /** |
+ * Performs visual changes on the user pod if there is an error. |
+ * @param {boolean} visible Whether to show or hide the display. |
+ */ |
+ setFocusedPodErrorDisplay: function(visible) { |
+ if (this.focusedPod_) |
+ this.focusedPod_.setErrorDisplay(visible); |
+ }, |
+ |
+ /** |
+ * Enables or disables transitions on the user pod. |
+ * @param {boolean} enable |
+ */ |
togglePinTransitions: function(enable) { |
for (var i = 0; i < this.pods.length; ++i) |
this.pods[i].toggleTransitions(enable); |
}, |
+ /** |
+ * Shows or hides the pin keyboard. |
+ * @param {boolean} visible |
+ */ |
setFocusedPodPinVisibility: function(visible) { |
if (this.focusedPod_ && this.focusedPod_.user.showPin) |
this.focusedPod_.setPinVisibility(visible); |