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 Polymer({ | 5 Polymer({ |
6 is: 'saml-confirm-password', | 6 is: 'saml-confirm-password', |
7 | 7 |
8 properties: { | 8 properties: { |
9 email: String, | 9 email: String, |
10 | 10 |
11 disabled: { | 11 disabled: {type: Boolean, value: false, observer: 'disabledChanged_'}, |
12 type: Boolean, | |
13 value: false, | |
14 observer: 'disabledChanged_' | |
15 }, | |
16 | 12 |
17 manualInput: { | 13 manualInput: |
18 type: Boolean, | 14 {type: Boolean, value: false, observer: 'manualInputChanged_'} |
19 value: false, | |
20 observer: 'manualInputChanged_' | |
21 } | |
22 }, | 15 }, |
23 | 16 |
24 ready: function() { | 17 ready: function() { |
25 /** | 18 /** |
26 * Workaround for | 19 * Workaround for |
27 * https://github.com/PolymerElements/neon-animation/issues/32 | 20 * https://github.com/PolymerElements/neon-animation/issues/32 |
28 * TODO(dzhioev): Remove when fixed in Polymer. | 21 * TODO(dzhioev): Remove when fixed in Polymer. |
29 */ | 22 */ |
30 var pages = this.$.animatedPages; | 23 var pages = this.$.animatedPages; |
31 delete pages._squelchNextFinishEvent; | 24 delete pages._squelchNextFinishEvent; |
32 Object.defineProperty(pages, '_squelchNextFinishEvent', | 25 Object.defineProperty(pages, '_squelchNextFinishEvent', { |
33 { get: function() { return false; } }); | 26 get: function() { |
| 27 return false; |
| 28 } |
| 29 }); |
34 }, | 30 }, |
35 | 31 |
36 reset: function() { | 32 reset: function() { |
37 this.$.cancelConfirmDlg.close(); | 33 this.$.cancelConfirmDlg.close(); |
38 this.disabled = false; | 34 this.disabled = false; |
39 this.$.navigation.closeVisible = true; | 35 this.$.navigation.closeVisible = true; |
40 if (this.$.animatedPages.selected != 0) | 36 if (this.$.animatedPages.selected != 0) |
41 this.$.animatedPages.selected = 0; | 37 this.$.animatedPages.selected = 0; |
42 this.$.passwordInput.isInvalid = false; | 38 this.$.passwordInput.isInvalid = false; |
43 this.$.passwordInput.value = ''; | 39 this.$.passwordInput.value = ''; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 this.$.confirmPasswordCard.classList.toggle('full-disabled', disabled); | 91 this.$.confirmPasswordCard.classList.toggle('full-disabled', disabled); |
96 }, | 92 }, |
97 | 93 |
98 onAnimationFinish_: function() { | 94 onAnimationFinish_: function() { |
99 if (this.$.animatedPages.selected == 1) | 95 if (this.$.animatedPages.selected == 1) |
100 this.$.passwordInput.value = ''; | 96 this.$.passwordInput.value = ''; |
101 }, | 97 }, |
102 | 98 |
103 manualInputChanged_: function() { | 99 manualInputChanged_: function() { |
104 var titleId = | 100 var titleId = |
105 this.manualInput ? 'manualPasswordTitle' : 'confirmPasswordTitle'; | 101 this.manualInput ? 'manualPasswordTitle' : 'confirmPasswordTitle'; |
106 var passwordInputLabelId = | 102 var passwordInputLabelId = |
107 this.manualInput ? 'manualPasswordInputLabel' : 'confirmPasswordLabel'; | 103 this.manualInput ? 'manualPasswordInputLabel' : 'confirmPasswordLabel'; |
108 var passwordInputErrorId = this.manualInput ? | 104 var passwordInputErrorId = this.manualInput ? |
109 'manualPasswordMismatch' : 'confirmPasswordIncorrectPassword'; | 105 'manualPasswordMismatch' : |
| 106 'confirmPasswordIncorrectPassword'; |
110 | 107 |
111 this.$.title.textContent = loadTimeData.getString(titleId); | 108 this.$.title.textContent = loadTimeData.getString(titleId); |
112 this.$.passwordInput.label = loadTimeData.getString(passwordInputLabelId); | 109 this.$.passwordInput.label = loadTimeData.getString(passwordInputLabelId); |
113 this.$.passwordInput.error = loadTimeData.getString(passwordInputErrorId); | 110 this.$.passwordInput.error = loadTimeData.getString(passwordInputErrorId); |
114 }, | 111 }, |
115 | 112 |
116 getConfirmPasswordInputLabel_: function() { | 113 getConfirmPasswordInputLabel_: function() { |
117 return loadTimeData.getString('confirmPasswordLabel'); | 114 return loadTimeData.getString('confirmPasswordLabel'); |
118 }, | 115 }, |
119 | 116 |
120 getConfirmPasswordInputError_: function() { | 117 getConfirmPasswordInputError_: function() { |
121 return loadTimeData.getString('manualPasswordMismatch'); | 118 return loadTimeData.getString('manualPasswordMismatch'); |
122 } | 119 } |
123 }); | 120 }); |
OLD | NEW |