OLD | NEW |
1 /* Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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 | 5 |
6 Polymer('gaia-password-changed', { | 6 Polymer('gaia-password-changed', { |
7 invalidate: function() { | 7 invalidate: function() { |
8 this.$.oldPasswordInput.setValid(false); | 8 this.$.oldPasswordInput.isInvalid = true; |
9 }, | 9 }, |
10 | 10 |
11 reset: function() { | 11 reset: function() { |
12 this.$.animatedPages.selected = 0; | 12 this.$.animatedPages.selected = 0; |
13 this.clearPassword(); | 13 this.clearPassword(); |
14 this.$.oldPasswordInput.setValid(true); | 14 this.$.oldPasswordInput.isInvalid = false; |
15 this.disabled = false; | 15 this.disabled = false; |
16 this.$.closeButton.hidden = false; | 16 this.$.closeButton.hidden = false; |
17 this.$.oldPasswordCard.classList.remove('disabled'); | 17 this.$.oldPasswordCard.classList.remove('disabled'); |
18 }, | 18 }, |
19 | 19 |
20 ready: function() { | 20 ready: function() { |
21 this.$.oldPasswordInput.addEventListener('buttonClick', function() { | 21 this.$.oldPasswordInputForm.addEventListener('submit', function() { |
22 var inputPassword = this.$.oldPasswordInput.inputValue; | 22 var inputPassword = this.$.oldPasswordInput.value; |
23 if (!inputPassword) | 23 if (!inputPassword) |
24 this.invalidate(); | 24 this.invalidate(); |
25 else { | 25 else { |
26 this.$.oldPasswordCard.classList.add('disabled'); | 26 this.$.oldPasswordCard.classList.add('disabled'); |
27 this.disabled = true; | 27 this.disabled = true; |
28 this.fire('passwordEnter', {password: inputPassword}); | 28 this.fire('passwordEnter', {password: inputPassword}); |
29 } | 29 } |
30 }.bind(this)); | 30 }.bind(this)); |
31 }, | 31 }, |
32 | 32 |
33 focus: function() { | 33 focus: function() { |
34 if (this.$.animatedPages.selected == 0) | 34 if (this.$.animatedPages.selected == 0) |
35 this.$.oldPasswordInput.focus(); | 35 this.$.oldPasswordInput.focus(); |
36 }, | 36 }, |
37 | 37 |
38 set disabled(value) { | 38 set disabled(value) { |
39 this.$.oldPasswordInput.disabled = value; | 39 this.$.oldPasswordInputForm.disabled = value; |
40 }, | 40 }, |
41 | 41 |
42 onForgotPasswordClicked: function() { | 42 onForgotPasswordClicked: function() { |
43 this.clearPassword(); | 43 this.clearPassword(); |
44 this.$.animatedPages.selected += 1; | 44 this.$.animatedPages.selected += 1; |
45 }, | 45 }, |
46 | 46 |
47 onTryAgainClicked: function() { | 47 onTryAgainClicked: function() { |
48 this.$.oldPasswordInput.setValid(true); | 48 this.$.oldPasswordInput.isInvalid = false; |
49 this.$.animatedPages.selected -= 1; | 49 this.$.animatedPages.selected -= 1; |
50 }, | 50 }, |
51 | 51 |
52 onTransitionEnd: function() { | 52 onTransitionEnd: function() { |
53 this.focus(); | 53 this.focus(); |
54 }, | 54 }, |
55 | 55 |
56 clearPassword: function() { | 56 clearPassword: function() { |
57 this.$.oldPasswordInput.inputValue = ''; | 57 this.$.oldPasswordInput.value = ''; |
58 }, | 58 }, |
59 | 59 |
60 onProceedClicked: function() { | 60 onProceedClicked: function() { |
61 this.disabled = true; | 61 this.disabled = true; |
62 this.$.closeButton.hidden = true; | 62 this.$.closeButton.hidden = true; |
63 this.$.animatedPages.selected = 2; | 63 this.$.animatedPages.selected = 2; |
64 this.fire('proceedAnyway'); | 64 this.fire('proceedAnyway'); |
65 }, | 65 }, |
66 | 66 |
67 onClose: function() { | 67 onClose: function() { |
68 this.disabled = true; | 68 this.disabled = true; |
69 this.fire('cancel'); | 69 this.fire('cancel'); |
70 }, | 70 }, |
71 }); | 71 }); |
OLD | NEW |