| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 cr.define('options', function() { | 5 cr.define('options', function() { |
| 6 /** @const */ var OptionsPage = options.OptionsPage; | 6 /** @const */ var OptionsPage = options.OptionsPage; |
| 7 | 7 |
| 8 ////////////////////////////////////////////////////////////////////////////// | 8 ////////////////////////////////////////////////////////////////////////////// |
| 9 // ManagedUserSetPassphraseOverlay class: | 9 // ManagedUserSetPassphraseOverlay class: |
| 10 | 10 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 updateDisplay_: function() { | 41 updateDisplay_: function() { |
| 42 var valid = | 42 var valid = |
| 43 $('passphrase-confirm').value == $('managed-user-passphrase').value; | 43 $('passphrase-confirm').value == $('managed-user-passphrase').value; |
| 44 $('passphrase-mismatch').hidden = valid; | 44 $('passphrase-mismatch').hidden = valid; |
| 45 $('passphrase-confirm').setCustomValidity( | 45 $('passphrase-confirm').setCustomValidity( |
| 46 valid ? '' : $('passphrase-mismatch').textContent); | 46 valid ? '' : $('passphrase-mismatch').textContent); |
| 47 $('save-passphrase').disabled = | 47 $('save-passphrase').disabled = |
| 48 !$('passphrase-confirm').validity.valid || | 48 !$('passphrase-confirm').validity.valid || |
| 49 !$('managed-user-passphrase').validity.valid; | 49 !$('managed-user-passphrase').validity.valid; |
| 50 }, | 50 }, |
| 51 /** @override */ |
| 52 canShowPage: function() { |
| 53 return ManagedUserSettings.getInstance().authenticationState == |
| 54 options.Authentication.AUTHENTICATED; |
| 55 }, |
| 51 }; | 56 }; |
| 52 | 57 |
| 53 // This is a class used for browsertests. | 58 // This is a class used for browsertests. |
| 54 var ManagedUserSetPassphraseForTesting = { | 59 var ManagedUserSetPassphraseForTesting = { |
| 55 getPassphraseInput: function() { | 60 getPassphraseInput: function() { |
| 56 return $('managed-user-passphrase'); | 61 return $('managed-user-passphrase'); |
| 57 }, | 62 }, |
| 58 getPassphraseConfirmInput: function() { | 63 getPassphraseConfirmInput: function() { |
| 59 return $('passphrase-confirm'); | 64 return $('passphrase-confirm'); |
| 60 }, | 65 }, |
| 61 getSavePassphraseButton: function() { | 66 getSavePassphraseButton: function() { |
| 62 return $('save-passphrase'); | 67 return $('save-passphrase'); |
| 63 }, | 68 }, |
| 64 updateDisplay: function() { | 69 updateDisplay: function() { |
| 65 return ManagedUserSetPassphraseOverlay.getInstance().updateDisplay_(); | 70 return ManagedUserSetPassphraseOverlay.getInstance().updateDisplay_(); |
| 66 } | 71 } |
| 67 }; | 72 }; |
| 68 | 73 |
| 69 // Export | 74 // Export |
| 70 return { | 75 return { |
| 71 ManagedUserSetPassphraseOverlay: ManagedUserSetPassphraseOverlay, | 76 ManagedUserSetPassphraseOverlay: ManagedUserSetPassphraseOverlay, |
| 72 ManagedUserSetPassphraseForTesting: ManagedUserSetPassphraseForTesting | 77 ManagedUserSetPassphraseForTesting: ManagedUserSetPassphraseForTesting |
| 73 }; | 78 }; |
| 74 | 79 |
| 75 }); | 80 }); |
| OLD | NEW |