Chromium Code Reviews| 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..28faabdfd9fbb5921510d6c8e0e266765a0a2bfe 100644 |
| --- a/chrome/browser/resources/chromeos/login/offline_ad_login.js |
| +++ b/chrome/browser/resources/chromeos/login/offline_ad_login.js |
| @@ -6,10 +6,20 @@ |
| * @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. |
| +/** @const */ var ACTIVE_DIRECTORY_ERROR_STATE = { |
|
michaelpg
2017/01/18 00:32:30
@enum {number} instead of const
Roman Sorokin (ftl)
2017/01/18 13:56:44
Done.
|
| + NONE : 0, |
|
michaelpg
2017/01/18 00:32:30
no space before :
Roman Sorokin (ftl)
2017/01/18 13:56:43
Done.
|
| + MACHINE_NAME_INVALID : 1, |
| + MACHINE_NAME_TOO_LONG : 2, |
| + BAD_USERNAME : 3, |
| + BAD_PASSWORD : 4, |
| +}; |
| Polymer({ |
| is: 'offline-ad-login', |
| + |
|
michaelpg
2017/01/18 00:32:30
remove blank line
Roman Sorokin (ftl)
2017/01/18 13:56:43
Done.
|
| properties: { |
| /** |
| * Whether the UI disabled. |
| @@ -40,7 +50,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 +87,35 @@ Polymer({ |
| this.$.userInput.value = user || ''; |
| this.$.machineNameInput.value = machineName || ''; |
| this.$.passwordInput.value = ''; |
| - this.$.passwordInput.isInvalid = !!user; |
| this.focus(); |
| }, |
| + setInvalid: function(value) { |
|
michaelpg
2017/01/18 00:32:30
how does this get "cleared" after a successful att
michaelpg
2017/01/18 00:32:30
annotate
Roman Sorokin (ftl)
2017/01/18 13:56:43
Done.
Roman Sorokin (ftl)
2017/01/18 13:56:44
Good point! Added it to |showStep|
|
| + this.$.machineNameInput.isInvalid = false; |
| + this.$.userInput.isInvalid = false; |
| + this.$.passwordInput.isInvalid = false; |
| + switch (value) { |
| + 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()) |