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

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: Several fixes Created 7 years, 11 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 initializePage: function() {
29 OptionsPage.prototype.initializePage.call(this);
30 $('passphrase').oninput = this.updateDisplay_;
31 $('passphrase-confirm').oninput = this.updateDisplay_;
32
33 $('save-passphrase').onclick = function() {
34 if ($('passphrase').value != $('passphrase-confirm').value) {
35 $('passphrase-mismatch').hidden = false;
36 return;
37 }
38 chrome.send('setPassphrase', [$('passphrase').value]);
39 $('passphrase').value = '';
40 $('passphrase-confirm').value = '';
41 OptionsPage.closeOverlay();
42 };
43 },
44 updateDisplay_: function() {
45 if ($('passphrase-confirm').value != $('passphrase').value) {
46 $('passphrase-mismatch').hidden = false;
Bernhard Bauer 2013/01/08 17:43:14 Could you do this with CSS rules (based on the cla
Adrian Kuegel 2013/01/09 12:10:05 Not sure how I could do that. I haven't done much
Bernhard Bauer 2013/02/04 16:13:35 Well, you wanna learn, right? ;-) You can actuall
Adrian Kuegel 2013/02/05 12:12:35 I think it is not possible to set the hidden attri
47 $('passphrase-confirm').setAttribute('class', 'unequal-passphrases');
Bernhard Bauer 2013/01/08 17:43:14 You can use .classList (https://developer.mozilla.
Adrian Kuegel 2013/01/09 12:10:05 Done.
48 $('save-passphrase').disabled = true;
49 }
50 else {
Bernhard Bauer 2013/01/08 17:43:14 Move to previous line
Adrian Kuegel 2013/01/09 12:10:05 Done.
51 $('save-passphrase').disabled = ($('passphrase-confirm').value == '' ||
Bernhard Bauer 2013/01/08 17:43:14 I think this one isn't necessary (if one of them i
Adrian Kuegel 2013/01/09 12:10:05 Done.
52 $('passphrase').value == '');
53 $('passphrase-mismatch').hidden = true;
54 $('passphrase-confirm').setAttribute('class', 'equal-passphrases');
55 $('passphrase').validity.valid = true;
56 }
57 },
58 };
59
60 // Export
61 return {
62 ManagedUserSetPassphraseOverlay: ManagedUserSetPassphraseOverlay
63 };
64
65 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698