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

Side by Side 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, 1 month 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 /**
6 * @fileoverview Polymer element for displaying AD domain joining and AD
7 * Authenticate user screens.
8 */
9
10 Polymer({
11 is: 'offline-ad-login',
12
13 properties: {
14 /**
15 * Whether the UI disabled.
16 */
17 disabled: {
18 type: Boolean,
19 value: false,
20 observer: 'disabledChanged_'
21 },
22 /**
23 * Whether to show machine name input field.
24 */
25 showMachineInput: {
26 type: Boolean,
27 value: false
28 },
29 /**
30 * The kerberos realm (AD Domain), the machine is part of.
31 */
32 realm: {
33 type: String,
34 observer: 'realmChanged_'
35 },
36 /**
37 * The user kerberos default realm. Used for autocompletion.
38 */
39 userRealm: String,
40 /**
41 * Welcome message on top of the UI.
42 */
43 adWelcomeMessage: String
44 },
45
46 /** @private */
47 realmChanged_: function() {
48 this.$.welcomeMsg.textContent =
49 loadTimeData.getStringF('ADAuthWelcomeMessage', this.realm);
50 },
51
52 /**
53 * @private
54 * */
Dan Beam 2016/10/28 21:07:45 nit: /** @private */
Roman Sorokin (ftl) 2016/10/31 11:37:10 Done.
55 disabledChanged_: function() {
56 this.$.gaiaCard.classList.toggle('disabled', this.disabled);
57 },
58
59 focus: function() {
60 if (this.showMachineInput && this.$.machineNameInput.value == '') {
61 this.$.machineNameInput.focus();
62 } else if (this.$.userInput.value == '') {
63 this.$.userInput.focus();
64 } else {
65 this.$.passwordInput.focus();
66 }
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
67 },
68
69 /**
70 * @param {!string|undefined} user
71 * @param {!string|undefined} machineName
72 */
73 setUser: function(user, machineName) {
74 if (user) {
75 this.$.userInput.value = user;
76 this.$.passwordInput.isInvalid = true;
77 } else {
78 this.$.userInput.value = '';
79 this.$.passwordInput.isInvalid = false;
80 }
Dan Beam 2016/10/28 21:07:45 nit: this.$.userInput.value = user || ''; this.$.
Roman Sorokin (ftl) 2016/10/31 11:37:10 Done.
81 this.$.machineNameInput.value = machineName || '';
82 this.$.passwordInput.value = '';
83 this.focus();
84 },
85
86 /** @private */
87 onSubmit_: function() {
88 if (this.showMachineInput && !this.$.machineNameInput.checkValidity())
89 return;
90 if (!this.$.passwordInput.checkValidity())
91 return;
92 var user = this.$.userInput.value;
93 if (user.indexOf('@') === -1) {
94 if (this.userRealm)
95 user = user + this.userRealm;
96 }
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.
97 var msg = {
98 'machinename': this.$.machineNameInput.value,
99 'username': user,
100 'password': this.$.passwordInput.value
101 };
102 this.$.passwordInput.value = '';
103 this.fire('authCompleted', msg);
104 },
105 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698