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 |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..99a132ac455c165491bab49af835aec071c266ca |
| --- /dev/null |
| +++ b/chrome/browser/resources/chromeos/login/offline_ad_login.js |
| @@ -0,0 +1,97 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +/** |
| + * @fileoverview Polymer element for displaying AD domain joining and AD |
| + * Authenticate user screens. |
| + */ |
| + |
| +Polymer({ |
| + is: 'offline-ad-login', |
| + |
| + properties: { |
| + /** |
| + * Whether the UI disabled. |
| + */ |
| + disabled: { |
| + type: Boolean, |
| + value: false, |
| + observer: 'disabledChanged_' |
| + }, |
| + /** |
| + * Whether to show machine name input field. |
| + */ |
| + showMachineInput: { |
| + type: Boolean, |
| + value: false |
| + }, |
| + /** |
| + * The kerberos realm (AD Domain), the machine is part of. |
| + */ |
| + realm: { |
| + type: String, |
| + observer: 'realmChanged_' |
| + }, |
| + /** |
| + * The user kerberos default realm. Used for autocompletion. |
| + */ |
| + userRealm: String, |
| + /** |
| + * Welcome message on top of the UI. |
| + */ |
| + adWelcomeMessage: String |
| + }, |
| + |
| + /** @private */ |
| + realmChanged_: function() { |
| + this.$.welcomeMsg.textContent = |
| + loadTimeData.getStringF('ADAuthWelcomeMessage', this.realm); |
| + }, |
| + |
| + /** @private */ |
| + disabledChanged_: function() { |
| + this.$.gaiaCard.classList.toggle('disabled', this.disabled); |
| + }, |
| + |
| + focus: function() { |
| + if (this.showMachineInput && /** @type {string} */ ( |
| + this.$.machineNameInput.value) == '') { |
| + this.$.machineNameInput.focus(); |
| + } else if (/** @type {string} */ (this.$.userInput.value) == '') { |
| + this.$.userInput.focus(); |
| + } else { |
| + this.$.passwordInput.focus(); |
| + } |
| + }, |
| + |
| + /** |
| + * @param {!string|undefined} user |
| + * @param {!string|undefined} machineName |
| + */ |
| + setUser: function(user, machineName) { |
| + /** @type {string} */ (this.$.userInput.value) = user || ''; |
|
Dan Beam
2016/10/31 23:52:25
were these needed for closure? assigning to an ex
Roman Sorokin (ftl)
2016/11/02 11:20:19
Yep, removed that. Can't user GaiaInputElement typ
|
| + /** @type {string} */ (this.$.machineNameInput.value) = machineName || ''; |
| + /** @type {string} */ (this.$.passwordInput.value) = ''; |
| + this.$.passwordInput.isInvalid = !!user; |
| + this.focus(); |
| + }, |
| + |
| + /** @private */ |
| + onSubmit_: function() { |
| + if (this.showMachineInput && !this.$.machineNameInput.checkValidity()) |
| + return; |
| + if (!this.$.passwordInput.checkValidity()) |
| + return; |
| + var user = /** @type {string} */ (this.$.userInput.value); |
| + if (!user.includes('@') && this.userRealm) |
| + user += this.userRealm; |
| + var msg = { |
| + 'machinename': this.$.machineNameInput.value, |
| + 'username': user, |
| + 'password': this.$.passwordInput.value |
| + }; |
| + this.$.passwordInput.value = ''; |
| + this.fire('authCompleted', msg); |
| + }, |
| +}); |