OLD | NEW |
(Empty) | |
| 1 /* Copyright 2015 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 Polymer('saml-confirm-password', { |
| 7 onClose: function() { |
| 8 this.disabled = true; |
| 9 this.$.cancelConfirmDlg.toggle(); |
| 10 }, |
| 11 |
| 12 onConfirmCancel: function() { |
| 13 this.fire('cancel'); |
| 14 }, |
| 15 |
| 16 reset: function() { |
| 17 this.$.cancelConfirmDlg.close(); |
| 18 this.disabled = false; |
| 19 this.$.closeButton.hidden = false; |
| 20 this.$.animatedPages.selected = 0; |
| 21 this.$.passwordInput.inputValue = ''; |
| 22 }, |
| 23 |
| 24 invalidate: function() { |
| 25 this.$.passwordInput.setValid(false); |
| 26 }, |
| 27 |
| 28 focus: function() { |
| 29 if (this.$.animatedPages.selected == 0) |
| 30 this.$.passwordInput.focus(); |
| 31 }, |
| 32 |
| 33 set disabled(value) { |
| 34 this.$.confirmPasswordCard.classList.toggle('full-disabled', value); |
| 35 this.$.passwordInput.disabled = value; |
| 36 this.$.closeButton.disabled = value; |
| 37 }, |
| 38 |
| 39 ready: function() { |
| 40 this.$.cancelConfirmDlg.addEventListener('core-overlay-close-completed', |
| 41 function() { |
| 42 this.disabled = false; |
| 43 }.bind(this)); |
| 44 this.$.passwordInput.addEventListener('buttonClick', function() { |
| 45 var inputPassword = this.$.passwordInput.inputValue; |
| 46 this.$.passwordInput.inputValue = ''; |
| 47 if (!inputPassword) { |
| 48 this.invalidate(); |
| 49 } else { |
| 50 this.$.animatedPages.selected += 1; |
| 51 this.$.closeButton.hidden = true; |
| 52 this.fire('passwordEnter', {password: inputPassword}); |
| 53 } |
| 54 }.bind(this))} |
| 55 }); |
OLD | NEW |