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

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

Issue 2433363004: Chromad: added AD Join ui, authpolicy_client (Closed)
Patch Set: Not close password_fd in AuthPolicyClient Created 4 years, 2 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
new file mode 100644
index 0000000000000000000000000000000000000000..5b761c519640c1dcad9938a5e54ee16f2ace9f00
--- /dev/null
+++ b/chrome/browser/resources/chromeos/login/offline_ad_login.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: 'offline-ad-login',
+
+ 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();
xiyuan 2016/10/26 22:03:16 What if machineNameInput is hidden ?
Roman Sorokin (ftl) 2016/10/27 13:10:45 Done.
+ } else if (this.$.userInput.value == '') {
+ this.$.userInput.focus();
+ } else {
+ this.$.passwordInput.focus();
+ }
+ },
+
+ onRealmChanged_: function() {
+ this.$.welcomeMsg.textContent =
+ loadTimeData.getStringF('ADAuthWelcomeMessage', this.realm);
xiyuan 2016/10/26 22:03:16 nit: wrong indent, add 2 more spaces
Roman Sorokin (ftl) 2016/10/27 13:10:45 Done.
+ },
+
+ setUser: function(user, machineName) {
xiyuan 2016/10/26 22:03:16 Document the function and mention |user| and |mach
Roman Sorokin (ftl) 2016/10/27 13:10:45 Done.
+ if (user) {
+ this.$.userInput.value = user;
+ this.$.passwordInput.isInvalid = true;
xiyuan 2016/10/26 22:03:16 Why setting/resetting the userInput changes passwo
Roman Sorokin (ftl) 2016/10/27 13:10:45 We used that way in offline_gaia to load ui with s
+ } 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');
xiyuan 2016/10/26 22:03:16 nit: seems the "if" could be replace with: this.
Roman Sorokin (ftl) 2016/10/27 13:10:45 Done.
+ }
+ };
+})());

Powered by Google App Engine
This is Rietveld 408576698