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

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

Issue 2433363004: Chromad: added AD Join ui, authpolicy_client (Closed)
Patch Set: More polishing 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..ec05a0c2d55d1a89f592407e7c5df3bfa354de55
--- /dev/null
+++ b/chrome/browser/resources/chromeos/login/offline_ad_login.js
@@ -0,0 +1,105 @@
+// 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
+ * */
Dan Beam 2016/10/28 21:07:45 nit: /** @private */
Roman Sorokin (ftl) 2016/10/31 11:37:10 Done.
+ disabledChanged_: function() {
+ this.$.gaiaCard.classList.toggle('disabled', this.disabled);
+ },
+
+ focus: function() {
+ if (this.showMachineInput && this.$.machineNameInput.value == '') {
+ this.$.machineNameInput.focus();
+ } else if (this.$.userInput.value == '') {
+ this.$.userInput.focus();
+ } else {
+ this.$.passwordInput.focus();
+ }
Dan Beam 2016/10/28 21:07:45 nit: no curlies
Roman Sorokin (ftl) 2016/10/31 11:37:10 Seems like I need it after all
+ },
+
+ /**
+ * @param {!string|undefined} user
+ * @param {!string|undefined} machineName
+ */
+ setUser: function(user, machineName) {
+ if (user) {
+ this.$.userInput.value = user;
+ this.$.passwordInput.isInvalid = true;
+ } else {
+ this.$.userInput.value = '';
+ this.$.passwordInput.isInvalid = false;
+ }
Dan Beam 2016/10/28 21:07:45 nit: this.$.userInput.value = user || ''; this.$.
Roman Sorokin (ftl) 2016/10/31 11:37:10 Done.
+ this.$.machineNameInput.value = machineName || '';
+ this.$.passwordInput.value = '';
+ this.focus();
+ },
+
+ /** @private */
+ onSubmit_: function() {
+ if (this.showMachineInput && !this.$.machineNameInput.checkValidity())
+ return;
+ if (!this.$.passwordInput.checkValidity())
+ return;
+ var user = this.$.userInput.value;
+ if (user.indexOf('@') === -1) {
+ if (this.userRealm)
+ user = user + this.userRealm;
+ }
Dan Beam 2016/10/28 21:07:45 nit: this seems equivalent and shorter if (!user.
Roman Sorokin (ftl) 2016/10/31 11:37:10 Done.
+ var msg = {
+ 'machinename': this.$.machineNameInput.value,
+ 'username': user,
+ 'password': this.$.passwordInput.value
+ };
+ this.$.passwordInput.value = '';
+ this.fire('authCompleted', msg);
+ },
+});

Powered by Google App Engine
This is Rietveld 408576698