| Index: chrome/browser/resources/chromeos/login/ad_ui.js
|
| diff --git a/chrome/browser/resources/chromeos/login/ad_ui.js b/chrome/browser/resources/chromeos/login/ad_ui.js
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..62d7950803ae4cc57d7a826a822ac59e0b959bc9
|
| --- /dev/null
|
| +++ b/chrome/browser/resources/chromeos/login/ad_ui.js
|
| @@ -0,0 +1,83 @@
|
| +// 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.
|
| +
|
| +Polymer((function() {
|
| + return {
|
| + is: 'ad-ui',
|
| +
|
| + properties: {
|
| + disabled: {
|
| + type: Boolean,
|
| + value: false,
|
| + observer: '_disabledChanged'
|
| + },
|
| + showMachineInput: {
|
| + type: Boolean,
|
| + value: false
|
| + },
|
| + realm: {
|
| + type: String,
|
| + observer: 'onRealmChanged_'
|
| + },
|
| + userRealm: String,
|
| + adWelcomeMessage: String
|
| + },
|
| +
|
| + focus: function() {
|
| + if (this.$.machineNameInput.value == '') {
|
| + this.$.machineNameInput.focus();
|
| + } else if (this.$.userInput.value == '') {
|
| + this.$.userInput.focus();
|
| + } else {
|
| + this.$.passwordInput.focus();
|
| + }
|
| + },
|
| +
|
| + onRealmChanged_: function() {
|
| + this.$.welcomeMsg.textContent =
|
| + loadTimeData.getStringF('ADAuthWelcomeMessage', this.realm);
|
| + },
|
| +
|
| + setUser: function(user, machineName) {
|
| + if (user) {
|
| + this.$.userInput.value = user;
|
| + this.$.passwordInput.isInvalid = true;
|
| + } else {
|
| + this.$.userInput.value = '';
|
| + this.$.passwordInput.isInvalid = false;
|
| + }
|
| + this.$.machineNameInput.value = machineName || '';
|
| + this.$.passwordInput.value = '';
|
| + this.focus();
|
| + },
|
| +
|
| + isRTL_: function() {
|
| + return !!document.querySelector('html[dir=rtl]');
|
| + },
|
| +
|
| + onSubmit_: function() {
|
| + if (!this.$.passwordInput.checkValidity())
|
| + return;
|
| + var user = this.$.userInput.value;
|
| + if (user.indexOf('@') === -1) {
|
| + if (this.userRealm)
|
| + user = user + this.userRealm;
|
| + }
|
| + var msg = {
|
| + 'machinename': this.$.machineNameInput.value,
|
| + 'username': user,
|
| + 'password': this.$.passwordInput.value
|
| + };
|
| + this.$.passwordInput.value = '';
|
| + this.fire('authCompleted', msg);
|
| + },
|
| +
|
| + _disabledChanged: function(newValue, oldValue) {
|
| + if (newValue)
|
| + this.$.gaiaCard.classList.add('disabled');
|
| + else
|
| + this.$.gaiaCard.classList.remove('disabled');
|
| + }
|
| + };
|
| +})());
|
|
|