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

Side by Side Diff: chrome/browser/resources/options/managed_user_set_passphrase.js

Issue 11783008: Add a lock to the managed user settings page and require authentication for unlocking. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use setCustomValidity in managed_user_set_passphrase.js. Created 7 years, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 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 cr.define('options', function() {
6 /** @const */ var OptionsPage = options.OptionsPage;
7
8 //////////////////////////////////////////////////////////////////////////////
9 // ManagedUserSetPassphraseOverlay class:
10
11 /**
12 * Encapsulated handling of the Managed User Set Passphrase page.
13 * @constructor
14 */
15 function ManagedUserSetPassphraseOverlay() {
16 OptionsPage.call(
17 this,
18 'setPassphrase',
19 loadTimeData.getString('setPassphraseTitle'),
20 'managed-user-set-passphrase-overlay');
21 }
22
23 cr.addSingletonGetter(ManagedUserSetPassphraseOverlay);
24
25 ManagedUserSetPassphraseOverlay.prototype = {
26 __proto__: OptionsPage.prototype,
27
28 /** @override */
29 initializePage: function() {
30 OptionsPage.prototype.initializePage.call(this);
31 $('managed-user-passphrase').oninput = this.updateDisplay_;
32 $('passphrase-confirm').oninput = this.updateDisplay_;
33
34 $('save-passphrase').onclick = function() {
35 chrome.send('setPassphrase', [$('managed-user-passphrase').value]);
36 $('managed-user-passphrase').value = '';
37 $('passphrase-confirm').value = '';
38 OptionsPage.closeOverlay();
39 };
40 },
41 updateDisplay_: function() {
42 if ($('passphrase-confirm').value != $('managed-user-passphrase').value) {
Bernhard Bauer 2013/02/05 12:52:23 I think it would be nicer to pull the result of th
43 $('passphrase-mismatch').hidden = false;
44 $('passphrase-confirm').setCustomValidity(
45 $('passphrase-mismatch').textContent);
46 $('save-passphrase').disabled = true;
47 }
48 else {
Bernhard Bauer 2013/02/05 12:52:23 On the same line as the closing brace, please :)
49 $('save-passphrase').disabled = $('passphrase-confirm').value == '';
Bernhard Bauer 2013/02/05 12:52:23 Instead of directly checking the value of #passphr
Adrian Kuegel 2013/02/05 13:21:05 I restructured the code accordingly. Now I also do
50 $('passphrase-confirm').setCustomValidity('');
51 $('passphrase-mismatch').hidden = true;
52 }
53 },
54 getPassphraseInput_: function() {
Bernhard Bauer 2013/02/05 12:52:23 Are these actually used?
Adrian Kuegel 2013/02/05 13:21:05 Not really, just by the test functions. But they c
55 return $('managed-user-passphrase');
56 },
57 getPassphraseConfirmInput_: function() {
58 return $('passphrase-confirm');
59 },
60 getSavePassphraseButton_: function() {
61 return $('save-passphrase');
62 },
63 /** @override */
64 canShowPage: function() {
65 return ManagedUserSettings.getInstance().canShowPage();
66 },
67 };
68
69 // The following functions should only be called by WebUI tests.
70 ManagedUserSetPassphraseOverlay.getPassphraseInput = function() {
71 return ManagedUserSetPassphraseOverlay.getInstance().getPassphraseInput_();
72 };
73 ManagedUserSetPassphraseOverlay.getPassphraseConfirmInput = function() {
74 var instance = ManagedUserSetPassphraseOverlay.getInstance();
75 return instance.getPassphraseConfirmInput_();
76 };
77 ManagedUserSetPassphraseOverlay.getSavePassphraseButton = function() {
78 var instance = ManagedUserSetPassphraseOverlay.getInstance();
79 return instance.getSavePassphraseButton_();
80 };
81 ManagedUserSetPassphraseOverlay.updateDisplay = function() {
82 return ManagedUserSetPassphraseOverlay.getInstance().updateDisplay_();
83 };
84
85 // Export
86 return {
87 ManagedUserSetPassphraseOverlay: ManagedUserSetPassphraseOverlay
88 };
89
90 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698