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

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: Not close password_fd in AuthPolicyClient 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 Polymer((function() {
6 return {
7 is: 'offline-ad-login',
8
9 properties: {
10 disabled: {
11 type: Boolean,
12 value: false,
13 observer: '_disabledChanged'
14 },
15 showMachineInput: {
16 type: Boolean,
17 value: false
18 },
19 realm: {
20 type: String,
21 observer: 'onRealmChanged_'
22 },
23 userRealm: String,
24 adWelcomeMessage: String
25 },
26
27 focus: function() {
28 if (this.$.machineNameInput.value == '') {
29 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.
30 } else if (this.$.userInput.value == '') {
31 this.$.userInput.focus();
32 } else {
33 this.$.passwordInput.focus();
34 }
35 },
36
37 onRealmChanged_: function() {
38 this.$.welcomeMsg.textContent =
39 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.
40 },
41
42 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.
43 if (user) {
44 this.$.userInput.value = user;
45 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
46 } else {
47 this.$.userInput.value = '';
48 this.$.passwordInput.isInvalid = false;
49 }
50 this.$.machineNameInput.value = machineName || '';
51 this.$.passwordInput.value = '';
52 this.focus();
53 },
54
55 isRTL_: function() {
56 return !!document.querySelector('html[dir=rtl]');
57 },
58
59 onSubmit_: function() {
60 if (!this.$.passwordInput.checkValidity())
61 return;
62 var user = this.$.userInput.value;
63 if (user.indexOf('@') === -1) {
64 if (this.userRealm)
65 user = user + this.userRealm;
66 }
67 var msg = {
68 'machinename': this.$.machineNameInput.value,
69 'username': user,
70 'password': this.$.passwordInput.value
71 };
72 this.$.passwordInput.value = '';
73 this.fire('authCompleted', msg);
74 },
75
76 _disabledChanged: function(newValue, oldValue) {
77 if (newValue)
78 this.$.gaiaCard.classList.add('disabled');
79 else
80 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.
81 }
82 };
83 })());
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698