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.value = ''; |
| 22 }, |
| 23 |
| 24 invalidate: function() { |
| 25 this.$.passwordInput.isInvalid = true; |
| 26 }, |
| 27 |
| 28 focus: function() { |
| 29 if (this.$.animatedPages.selected == 0) |
| 30 this.$.passwordInput.focus(); |
| 31 }, |
| 32 |
| 33 onPasswordSubmitted: function() { |
| 34 var inputPassword = this.$.passwordInput.value; |
| 35 this.$.passwordInput.value = ''; |
| 36 if (!inputPassword) { |
| 37 this.invalidate(); |
| 38 } else { |
| 39 this.$.animatedPages.selected += 1; |
| 40 this.$.closeButton.hidden = true; |
| 41 this.fire('passwordEnter', {password: inputPassword}); |
| 42 } |
| 43 }, |
| 44 |
| 45 set disabled(value) { |
| 46 this.$.confirmPasswordCard.classList.toggle('full-disabled', value); |
| 47 this.$.inputForm.disabled = value; |
| 48 this.$.closeButton.disabled = value; |
| 49 }, |
| 50 |
| 51 ready: function() { |
| 52 this.$.cancelConfirmDlg.addEventListener('core-overlay-close-completed', |
| 53 function() { |
| 54 this.disabled = false; |
| 55 }.bind(this)); |
| 56 } |
| 57 }); |
OLD | NEW |