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

Unified Diff: chrome/browser/resources/chromeos/login/offline_ad_login.js

Issue 2622273002: Handle login and password error for the domain join (Closed)
Patch Set: Address Michael's comments Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/chromeos/login/offline_ad_login.js
diff --git a/chrome/browser/resources/chromeos/login/offline_ad_login.js b/chrome/browser/resources/chromeos/login/offline_ad_login.js
index bfbc1da7950aee33f6f1ee3206bc86294112c762..4847247b59b0a09daaafde9aa53d0860253efed0 100644
--- a/chrome/browser/resources/chromeos/login/offline_ad_login.js
+++ b/chrome/browser/resources/chromeos/login/offline_ad_login.js
@@ -6,6 +6,15 @@
* @fileoverview Polymer element for displaying AD domain joining and AD
* Authenticate user screens.
*/
+// Possible error states of the screen. Must be in the same order as
+// ActiveDirectoryErrorState enum values.
+/** @enum {number} */ var ACTIVE_DIRECTORY_ERROR_STATE = {
+ NONE: 0,
+ MACHINE_NAME_INVALID: 1,
+ MACHINE_NAME_TOO_LONG: 2,
+ BAD_USERNAME: 3,
+ BAD_PASSWORD: 4,
+};
Polymer({
is: 'offline-ad-login',
@@ -40,7 +49,11 @@ Polymer({
/**
* Welcome message on top of the UI.
*/
- adWelcomeMessage: String
+ adWelcomeMessage: String,
+ /**
+ * Error message for the machine name input.
+ */
+ machineNameError: String,
},
/** @private */
@@ -73,10 +86,38 @@ Polymer({
this.$.userInput.value = user || '';
this.$.machineNameInput.value = machineName || '';
this.$.passwordInput.value = '';
- this.$.passwordInput.isInvalid = !!user;
this.focus();
},
+ /**
+ * @param {ACTIVE_DIRECTORY_ERROR_STATE} error_state
+ */
+ setInvalid: function(error_state) {
+ this.$.machineNameInput.isInvalid = false;
+ this.$.userInput.isInvalid = false;
+ this.$.passwordInput.isInvalid = false;
+ switch (error_state) {
+ case ACTIVE_DIRECTORY_ERROR_STATE.NONE:
+ break;
+ case ACTIVE_DIRECTORY_ERROR_STATE.MACHINE_NAME_INVALID:
+ this.machineNameError =
+ loadTimeData.getString('adJoinErrorMachineNameInvalid');
+ this.$.machineNameInput.isInvalid = true;
+ break;
+ case ACTIVE_DIRECTORY_ERROR_STATE.MACHINE_NAME_TOO_LONG:
+ this.machineNameError =
+ loadTimeData.getString('adJoinErrorMachineNameTooLong');
+ this.$.machineNameInput.isInvalid = true;
+ break;
+ case ACTIVE_DIRECTORY_ERROR_STATE.BAD_USERNAME:
+ this.$.userInput.isInvalid = true;
+ break;
+ case ACTIVE_DIRECTORY_ERROR_STATE.BAD_PASSWORD:
+ this.$.passwordInput.isInvalid = true;
+ break;
+ }
+ },
+
/** @private */
onSubmit_: function() {
if (this.showMachineInput && !this.$.machineNameInput.checkValidity())

Powered by Google App Engine
This is Rietveld 408576698