Diffstat (limited to 'frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/LoginForm.js') (more/less context) (ignore whitespace changes)
-rw-r--r-- | frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/LoginForm.js | 29 |
1 files changed, 10 insertions, 19 deletions
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/LoginForm.js b/frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/LoginForm.js index eafcdbc..3aeac0c 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/LoginForm.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Mobile/Components/LoginForm.js | |||
@@ -1,356 +1,347 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | Clipperz.Base.module('Clipperz.PM.UI.Mobile.Components'); | 24 | Clipperz.Base.module('Clipperz.PM.UI.Mobile.Components'); |
27 | 25 | ||
28 | Clipperz.PM.UI.Mobile.Components.LoginForm = function(args) { | 26 | Clipperz.PM.UI.Mobile.Components.LoginForm = function(args) { |
29 | args = args || {}; | 27 | args = args || {}; |
30 | 28 | ||
31 | this._pin = ''; | 29 | this._pin = ''; |
32 | 30 | ||
33 | this._message = null; | 31 | this._message = null; |
34 | this._steps = 0; | 32 | this._steps = 0; |
35 | this._actualSteps = 0; | 33 | this._actualSteps = 0; |
36 | 34 | ||
37 | this._callback = null; | 35 | this._callback = null; |
38 | this._errorCallback = null; | 36 | this._errorCallback = null; |
39 | 37 | ||
40 | this._mode = 'CREDENTIALS'; | 38 | this._mode = 'CREDENTIALS'; |
41 | 39 | ||
42 | Clipperz.PM.UI.Mobile.Components.LoginForm.superclass.constructor.apply(this, arguments); | 40 | Clipperz.PM.UI.Mobile.Components.LoginForm.superclass.constructor.apply(this, arguments); |
43 | 41 | ||
44 | return this; | 42 | return this; |
45 | } | 43 | } |
46 | 44 | ||
47 | //============================================================================= | 45 | //============================================================================= |
48 | 46 | ||
49 | Clipperz.Base.extend(Clipperz.PM.UI.Mobile.Components.LoginForm, Clipperz.PM.UI.Common.Components.BaseComponent, { | 47 | Clipperz.Base.extend(Clipperz.PM.UI.Mobile.Components.LoginForm, Clipperz.PM.UI.Common.Components.BaseComponent, { |
50 | 48 | ||
51 | //------------------------------------------------------------------------- | 49 | //------------------------------------------------------------------------- |
52 | 50 | ||
53 | 'toString': function () { | 51 | 'toString': function () { |
54 | return "Clipperz.PM.UI.Mobile.Components.LoginForm component"; | 52 | return "Clipperz.PM.UI.Mobile.Components.LoginForm component"; |
55 | }, | 53 | }, |
56 | 54 | ||
57 | //------------------------------------------------------------------------- | 55 | //------------------------------------------------------------------------- |
58 | 56 | ||
59 | 'callback': function () { | 57 | 'callback': function () { |
60 | return this._callback; | 58 | return this._callback; |
61 | }, | 59 | }, |
62 | 60 | ||
63 | 'errorCallback': function () { | 61 | 'errorCallback': function () { |
64 | return this._errorCallback; | 62 | return this._errorCallback; |
65 | }, | 63 | }, |
66 | 64 | ||
67 | //------------------------------------------------------------------------- | 65 | //------------------------------------------------------------------------- |
68 | 66 | ||
69 | 'mode': function () { | 67 | 'mode': function () { |
70 | return this._mode; | 68 | return this._mode; |
71 | }, | 69 | }, |
72 | 70 | ||
73 | 'setMode': function (aValue) { | 71 | 'setMode': function (aValue) { |
74 | this._mode = aValue; | 72 | this._mode = aValue; |
75 | }, | 73 | }, |
76 | 74 | ||
77 | //.......................................................................... | 75 | //.......................................................................... |
78 | 76 | ||
79 | 'pin': function () { | 77 | 'pin': function () { |
80 | return this._pin; | 78 | return this._pin; |
81 | }, | 79 | }, |
82 | 80 | ||
83 | 'setPin': function (aValue) { | 81 | 'setPin': function (aValue) { |
84 | this._pin = aValue; | 82 | this._pin = aValue; |
85 | }, | 83 | }, |
86 | 84 | ||
87 | //.......................................................................... | 85 | //.......................................................................... |
88 | 86 | ||
89 | 'username': function () { | 87 | 'username': function () { |
90 | return this._username; | 88 | return this._username; |
91 | }, | 89 | }, |
92 | 90 | ||
93 | 'setUsername': function (aValue) { | 91 | 'setUsername': function (aValue) { |
94 | this._username = aValue; | 92 | this._username = aValue; |
95 | }, | 93 | }, |
96 | 94 | ||
97 | //.......................................................................... | 95 | //.......................................................................... |
98 | 96 | ||
99 | 'passphrase': function () { | 97 | 'passphrase': function () { |
100 | return this._passphrase; | 98 | return this._passphrase; |
101 | }, | 99 | }, |
102 | 100 | ||
103 | 'setPassphrase': function (aValue) { | 101 | 'setPassphrase': function (aValue) { |
104 | this._passphrase = aValue; | 102 | this._passphrase = aValue; |
105 | }, | 103 | }, |
106 | 104 | ||
107 | //------------------------------------------------------------------------- | 105 | //------------------------------------------------------------------------- |
108 | 106 | ||
109 | 'message': function () { | 107 | 'message': function () { |
110 | return this._message; | 108 | return this._message; |
111 | }, | 109 | }, |
112 | 110 | ||
113 | '_setMessage': function (aValue) { | 111 | '_setMessage': function (aValue) { |
114 | this._message = aValue; | 112 | this._message = aValue; |
115 | 113 | ||
116 | if (aValue == null) { | 114 | if (aValue == null) { |
117 | MochiKit.Style.hideElement(this.getElement('credentialsMessage')); | 115 | MochiKit.Style.hideElement(this.getElement('credentialsMessage')); |
118 | } else { | 116 | } else { |
119 | this.getElement('message').innerHTML = aValue; | 117 | this.getElement('message').innerHTML = aValue; |
120 | MochiKit.Style.showElement(this.getElement('credentialsMessage')); | 118 | MochiKit.Style.showElement(this.getElement('credentialsMessage')); |
121 | } | 119 | } |
122 | }, | 120 | }, |
123 | 121 | ||
124 | 'setMessage': function (aValue) { | 122 | 'setMessage': function (aValue) { |
125 | this._setMessage(aValue); | 123 | this._setMessage(aValue); |
126 | MochiKit.DOM.removeElementClass(this.getElement('credentialsMessage'), 'error'); | 124 | MochiKit.DOM.removeElementClass(this.getElement('credentialsMessage'), 'error'); |
127 | }, | 125 | }, |
128 | 126 | ||
129 | 'setErrorMessage': function (aValue) { | 127 | 'setErrorMessage': function (aValue) { |
130 | this._setMessage(aValue); | 128 | this._setMessage(aValue); |
131 | MochiKit.DOM.addElementClass(this.getElement('credentialsMessage'), 'error'); | 129 | MochiKit.DOM.addElementClass(this.getElement('credentialsMessage'), 'error'); |
132 | }, | 130 | }, |
133 | 131 | ||
134 | //------------------------------------------------------------------------- | 132 | //------------------------------------------------------------------------- |
135 | 133 | ||
136 | 'setCallbacks': function (args) { | 134 | 'setCallbacks': function (args) { |
137 | this._callback = args['callback']; | 135 | this._callback = args['callback']; |
138 | this._errorCallback = args['errorCallback']; | 136 | this._errorCallback = args['errorCallback']; |
139 | }, | 137 | }, |
140 | 138 | ||
141 | 'showErrors': function (args) { | 139 | 'showErrors': function (args) { |
142 | //console.log("LoginForm.showErrors", args); | ||
143 | if (args['previousFailedAttempt'] == 'LOGIN') { | 140 | if (args['previousFailedAttempt'] == 'LOGIN') { |
144 | this.setErrorMessage("Wrong credentials"); | 141 | this.setErrorMessage("Wrong credentials"); |
145 | } else if (args['previousFailedAttempt'] == 'PIN') { | 142 | } else if (args['previousFailedAttempt'] == 'PIN') { |
146 | if (args['failedAttempts'] == -1) { | 143 | if (args['failedAttempts'] == -1) { |
147 | this.setErrorMessage("Wrong PIN - Resetted"); | 144 | this.setErrorMessage("Wrong PIN - Resetted"); |
148 | } else { | 145 | } else { |
149 | this.setErrorMessage("Wrong PIN"); | 146 | this.setErrorMessage("Wrong PIN"); |
150 | } | 147 | } |
151 | } else { | 148 | } else { |
152 | this.setMessage(null); | 149 | this.setMessage(null); |
153 | } | 150 | } |
154 | }, | 151 | }, |
155 | 152 | ||
156 | 'updateWithArgs': function (args) { | 153 | 'updateWithArgs': function (args) { |
157 | this.renderIfNeeded(); | 154 | this.renderIfNeeded(); |
158 | this.setCallbacks(args); | 155 | this.setCallbacks(args); |
159 | this.showErrors(args); | 156 | this.showErrors(args); |
160 | this.updateRendering(); | 157 | this.updateRendering(); |
161 | }, | 158 | }, |
162 | 159 | ||
163 | 'showPinLogin': function (args) { | 160 | 'showPinLogin': function (args) { |
164 | this.setPin(''); | 161 | this.setPin(''); |
165 | this.setMode('PIN'); | 162 | this.setMode('PIN'); |
166 | this.updateWithArgs(args); | 163 | this.updateWithArgs(args); |
167 | 164 | ||
168 | // $(this.getAnchor('PIN')).focus(); | 165 | // $(this.getAnchor('PIN')).focus(); |
169 | this.getElement('PIN').focus(); | 166 | this.getElement('PIN').focus(); |
170 | }, | 167 | }, |
171 | 168 | ||
172 | 'showCredentialsLogin': function (args) { | 169 | 'showCredentialsLogin': function (args) { |
173 | this.setMode('CREDENTIALS'); | 170 | this.setMode('CREDENTIALS'); |
174 | this.updateWithArgs(args); | 171 | this.updateWithArgs(args); |
175 | 172 | ||
176 | if (this.getElement('usernameField').value.length == 0) { | 173 | if (this.getElement('usernameField').value.length == 0) { |
177 | // $(this.getAnchor('usernameField')).focus(); | 174 | // $(this.getAnchor('usernameField')).focus(); |
178 | this.getElement('usernameField').focus(); | 175 | this.getElement('usernameField').focus(); |
179 | } else { | 176 | } else { |
180 | // $(this.getAnchor('passphraseField')).focus(); | 177 | // $(this.getAnchor('passphraseField')).focus(); |
181 | this.getElement('passphraseField').focus(); | 178 | this.getElement('passphraseField').focus(); |
182 | this.getElement('passphraseField').select(); | 179 | this.getElement('passphraseField').select(); |
183 | } | 180 | } |
184 | }, | 181 | }, |
185 | 182 | ||
186 | //------------------------------------------------------------------------- | 183 | //------------------------------------------------------------------------- |
187 | 184 | ||
188 | 'renderIfNeeded': function () { | 185 | 'renderIfNeeded': function () { |
189 | if (this.isFullyRendered() == false) { | 186 | if (this.isFullyRendered() == false) { |
190 | this.render(); | 187 | this.render(); |
191 | }; | 188 | }; |
192 | this.updateRendering(); | 189 | this.updateRendering(); |
193 | }, | 190 | }, |
194 | 191 | ||
195 | 'updateRendering': function () { | 192 | 'updateRendering': function () { |
196 | MochiKit.Style.showElement(this.getElement('credentialsBody')); | 193 | MochiKit.Style.showElement(this.getElement('credentialsBody')); |
197 | MochiKit.Style.hideElement(this.getElement('validating')); | 194 | MochiKit.Style.hideElement(this.getElement('validating')); |
198 | 195 | ||
199 | // this.hideAllPanes(); | 196 | // this.hideAllPanes(); |
200 | MochiKit.Base.map(function (aNode) { MochiKit.Style.hideElement(aNode); }, MochiKit.Selector.findDocElements('div.credentialsBody > div')); | 197 | MochiKit.Base.map(function (aNode) { MochiKit.Style.hideElement(aNode); }, MochiKit.Selector.findDocElements('div.credentialsBody > div')); |
201 | if (this.mode() == 'CREDENTIALS') { | 198 | if (this.mode() == 'CREDENTIALS') { |
202 | selectedPanel = this.getElement('credentials') | 199 | selectedPanel = this.getElement('credentials') |
203 | } else if (this.mode() == 'PIN') { | 200 | } else if (this.mode() == 'PIN') { |
204 | selectedPanel = this.getElement('pin') | 201 | selectedPanel = this.getElement('pin') |
205 | // this.updatePinDisplay(); | 202 | // this.updatePinDisplay(); |
206 | } else { | 203 | } else { |
207 | throw 'Unhandled login form mode'; | 204 | throw 'Unhandled login form mode'; |
208 | } | 205 | } |
209 | MochiKit.Style.showElement(selectedPanel); | 206 | MochiKit.Style.showElement(selectedPanel); |
210 | 207 | ||
211 | MochiKit.Style.hideElement(this.getElement('validating')); | 208 | MochiKit.Style.hideElement(this.getElement('validating')); |
212 | }, | 209 | }, |
213 | 210 | ||
214 | 'renderSelf': function() { | 211 | 'renderSelf': function() { |
215 | var selectedPanel; | 212 | var selectedPanel; |
216 | this.append(this.element(), {tag:'div', id:'login', children:[ | 213 | this.append(this.element(), {tag:'div', id:'login', children:[ |
217 | {tag:'div', cls:'toolbar', children:[ | 214 | {tag:'div', cls:'toolbar', children:[ |
218 | {tag:'h1', html:"clipperz"} | 215 | {tag:'h1', html:"clipperz"} |
219 | ]}, | 216 | ]}, |
220 | {tag:'div', cls:'scroll', children:[ | 217 | {tag:'div', cls:'scroll', children:[ |
221 | //================================================================== | 218 | //================================================================== |
222 | {tag:'div', cls:'credentialsMessage', id:this.getId('credentialsMessage'), children:[ | 219 | {tag:'div', cls:'credentialsMessage', id:this.getId('credentialsMessage'), children:[ |
223 | {tag:'h1', cls:'message', id:this.getId('message'), html:"Message"} | 220 | {tag:'h1', cls:'message', id:this.getId('message'), html:"Message"} |
224 | ]}, | 221 | ]}, |
225 | //================================================================== | 222 | //================================================================== |
226 | {tag:'div', cls:'credentialsBody', id:this.getId('credentialsBody'), children:[ | 223 | {tag:'div', cls:'credentialsBody', id:this.getId('credentialsBody'), children:[ |
227 | //-------------------------------------------------------------- | 224 | //-------------------------------------------------------------- |
228 | {tag:'div', cls:'pin', id:this.getId('pin'), children:[ | 225 | {tag:'div', cls:'pin', id:this.getId('pin'), children:[ |
229 | {tag:'form', cls:'scroll', id:this.getId('pinForm'), children:[ | 226 | {tag:'form', cls:'scroll', id:this.getId('pinForm'), children:[ |
230 | {tag:'ul', cls:'edit rounded', children:[ | 227 | {tag:'ul', cls:'edit rounded', children:[ |
231 | {tag:'li', children:[{tag:'input', type:'number', name:'PIN', placeholder:"PIN", id:this.getId('PIN') }]}, | 228 | {tag:'li', children:[{tag:'input', type:'number', name:'PIN', placeholder:"PIN", id:this.getId('PIN') }]}, |
232 | ]}, | 229 | ]}, |
233 | {tag:'a', href:'#', cls:'greenButton', id:this.getId('pinSubmitButton'), html:"Login"} | 230 | {tag:'a', href:'#', cls:'greenButton', id:this.getId('pinSubmitButton'), html:"Login"} |
234 | ]} | 231 | ]} |
235 | ]}, | 232 | ]}, |
236 | //-------------------------------------------------------------- | 233 | //-------------------------------------------------------------- |
237 | {tag:'div', cls:'credentials', id:this.getId('credentials'), children:[ | 234 | {tag:'div', cls:'credentials', id:this.getId('credentials'), children:[ |
238 | {tag:'form', cls:'scroll', id:this.getId('credentialsForm'), children:[ | 235 | {tag:'form', cls:'scroll', id:this.getId('credentialsForm'), children:[ |
239 | {tag:'ul', cls:'edit rounded', children:[ | 236 | {tag:'ul', cls:'edit rounded', children:[ |
240 | {tag:'li', children:[{tag:'input', type:'email', name:'name', /*value:'joe',*/ placeholder:"username", id:this.getId('usernameField') }]}, | 237 | {tag:'li', children:[{tag:'input', type:'email', name:'name', /*value:'joe',*/ placeholder:"username", id:this.getId('usernameField') }]}, |
241 | {tag:'li', children:[{tag:'input', type:'password', name:'passphrase', /*value:'clipperz',*/placeholder:"passphrase", id:this.getId('passphraseField') }]} | 238 | {tag:'li', children:[{tag:'input', type:'password', name:'passphrase', /*value:'clipperz',*/placeholder:"passphrase", id:this.getId('passphraseField') }]} |
242 | ]}, | 239 | ]}, |
243 | {tag:'a', href:'#', cls:'greenButton', id:this.getId('credentialsSubmitButton'), html:"Login"} | 240 | {tag:'a', href:'#', cls:'greenButton', id:this.getId('credentialsSubmitButton'), html:"Login"} |
244 | // {tag:'input', type:'submit', cls:'greenButton', id:this.getId('credentialsSubmitButton'), value:"Login"} | 241 | // {tag:'input', type:'submit', cls:'greenButton', id:this.getId('credentialsSubmitButton'), value:"Login"} |
245 | 242 | ||
246 | ]} | 243 | ]} |
247 | ]}, | 244 | ]}, |
248 | //-------------------------------------------------------------- | 245 | //-------------------------------------------------------------- |
249 | ]}, | 246 | ]}, |
250 | //================================================================== | 247 | //================================================================== |
251 | {tag:'div', cls:'validating', id:this.getId('validating'), children:[ | 248 | {tag:'div', cls:'validating', id:this.getId('validating'), children:[ |
252 | {tag:'div', cls:'loading', children:[ | 249 | {tag:'div', cls:'loading', children:[ |
253 | {tag:'div', cls:'spinner', children:[ | 250 | {tag:'div', cls:'spinner', children:[ |
254 | {tag:'div', cls:'bar01'}, | 251 | {tag:'div', cls:'bar01'}, |
255 | {tag:'div', cls:'bar02'}, | 252 | {tag:'div', cls:'bar02'}, |
256 | {tag:'div', cls:'bar03'}, | 253 | {tag:'div', cls:'bar03'}, |
257 | {tag:'div', cls:'bar04'}, | 254 | {tag:'div', cls:'bar04'}, |
258 | {tag:'div', cls:'bar05'}, | 255 | {tag:'div', cls:'bar05'}, |
259 | {tag:'div', cls:'bar06'}, | 256 | {tag:'div', cls:'bar06'}, |
260 | {tag:'div', cls:'bar07'}, | 257 | {tag:'div', cls:'bar07'}, |
261 | {tag:'div', cls:'bar08'}, | 258 | {tag:'div', cls:'bar08'}, |
262 | {tag:'div', cls:'bar09'}, | 259 | {tag:'div', cls:'bar09'}, |
263 | {tag:'div', cls:'bar10'}, | 260 | {tag:'div', cls:'bar10'}, |
264 | {tag:'div', cls:'bar11'}, | 261 | {tag:'div', cls:'bar11'}, |
265 | {tag:'div', cls:'bar12'} | 262 | {tag:'div', cls:'bar12'} |
266 | ]} | 263 | ]} |
267 | ]}, | 264 | ]}, |
268 | {tag:'div', id:this.getId('loadingMessage')}, | 265 | {tag:'div', id:this.getId('loadingMessage')}, |
269 | {tag:'a', href:'#', cls:'grayButton', id:this.getId('loginCancelButton'), html:"Cancel"} | 266 | {tag:'a', href:'#', cls:'grayButton', id:this.getId('loginCancelButton'), html:"Cancel"} |
270 | ]} | 267 | ]} |
271 | //================================================================== | 268 | //================================================================== |
272 | ]} | 269 | ]} |
273 | ]}); | 270 | ]}); |
274 | 271 | ||
275 | MochiKit.Signal.connect(this.getElement('credentialsForm'), 'onsubmit', this, 'submitCredentialsHandler'); | 272 | MochiKit.Signal.connect(this.getElement('credentialsForm'), 'onsubmit', this, 'submitCredentialsHandler'); |
276 | MochiKit.Signal.connect(this.getElement('credentialsSubmitButton'), 'onclick', this, 'submitCredentialsHandler'); | 273 | MochiKit.Signal.connect(this.getElement('credentialsSubmitButton'), 'onclick', this, 'submitCredentialsHandler'); |
277 | 274 | ||
278 | MochiKit.Signal.connect(this.getElement('pinForm'), 'onsubmit', this, 'submitPinHandler'); | 275 | MochiKit.Signal.connect(this.getElement('pinForm'), 'onsubmit', this, 'submitPinHandler'); |
279 | MochiKit.Signal.connect(this.getElement('pinSubmitButton'), 'onclick', this, 'submitPinHandler'); | 276 | MochiKit.Signal.connect(this.getElement('pinSubmitButton'), 'onclick', this, 'submitPinHandler'); |
280 | 277 | ||
281 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'initProgress', this, 'initProgressHandle'); | 278 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'initProgress', this, 'initProgressHandle'); |
282 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'updateProgress',this, 'updateProgressHandle'); | 279 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'updateProgress',this, 'updateProgressHandle'); |
283 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'advanceProgress',this, 'advanceProgressHandle'); | 280 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'advanceProgress',this, 'advanceProgressHandle'); |
284 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'progressDone', this, 'progressDoneHandle'); | 281 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'progressDone', this, 'progressDoneHandle'); |
285 | }, | 282 | }, |
286 | 283 | ||
287 | //------------------------------------------------------------------------- | 284 | //------------------------------------------------------------------------- |
288 | 285 | ||
289 | 'submitPinHandler': function (anEvent) { | 286 | 'submitPinHandler': function (anEvent) { |
290 | varpin; | 287 | varpin; |
291 | 288 | ||
292 | this.setMessage(null); | 289 | this.setMessage(null); |
293 | pin = this.getElement('PIN').value; | 290 | pin = this.getElement('PIN').value; |
294 | // $(this.getAnchor('PIN')).blur(); | 291 | // $(this.getAnchor('PIN')).blur(); |
295 | this.getElement('PIN').blur(); | 292 | this.getElement('PIN').blur(); |
296 | 293 | ||
297 | credentials = Clipperz.PM.PIN.credentialsWithPIN(pin); | 294 | credentials = Clipperz.PM.PIN.credentialsWithPIN(pin); |
298 | this.loginWithCredentials(credentials); | 295 | this.loginWithCredentials(credentials); |
299 | }, | 296 | }, |
300 | 297 | ||
301 | 'submitCredentialsHandler': function (anEvent) { | 298 | 'submitCredentialsHandler': function (anEvent) { |
302 | //console.log("submitCredentialsHandler"); | ||
303 | varcredentials; | 299 | varcredentials; |
304 | 300 | ||
305 | this.setMessage(null); | 301 | this.setMessage(null); |
306 | 302 | ||
307 | credentials = {}; | 303 | credentials = {}; |
308 | credentials['username'] = this.getElement('usernameField').value; | 304 | credentials['username'] = this.getElement('usernameField').value; |
309 | credentials['passphrase'] = this.getElement('passphraseField').value; | 305 | credentials['passphrase'] = this.getElement('passphraseField').value; |
310 | // $(this.getAnchor('passphraseField')).blur(); | 306 | // $(this.getAnchor('passphraseField')).blur(); |
311 | this.getElement('passphraseField').blur(); | 307 | this.getElement('passphraseField').blur(); |
312 | 308 | ||
313 | this.loginWithCredentials(credentials); | 309 | this.loginWithCredentials(credentials); |
314 | }, | 310 | }, |
315 | 311 | ||
316 | //------------------------------------------------------------------------- | 312 | //------------------------------------------------------------------------- |
317 | 313 | ||
318 | 'loginWithCredentials': function (someCredentials) { | 314 | 'loginWithCredentials': function (someCredentials) { |
319 | varargs; | 315 | varargs; |
320 | 316 | ||
321 | args = {}; | 317 | args = {}; |
322 | args['credentials'] = someCredentials; | 318 | args['credentials'] = someCredentials; |
323 | args['errorCallback'] = this.errorCallback(); | 319 | args['errorCallback'] = this.errorCallback(); |
324 | 320 | ||
325 | MochiKit.Style.hideElement(this.getElement('credentialsBody')); | 321 | MochiKit.Style.hideElement(this.getElement('credentialsBody')); |
326 | MochiKit.Style.showElement(this.getElement('validating')); | 322 | MochiKit.Style.showElement(this.getElement('validating')); |
327 | 323 | ||
328 | MochiKit.Async.callLater(0.1, this.callback(), args); | 324 | MochiKit.Async.callLater(0.1, this.callback(), args); |
329 | }, | 325 | }, |
330 | 326 | ||
331 | //------------------------------------------------------------------------- | 327 | //------------------------------------------------------------------------- |
332 | 328 | ||
333 | 'initProgressHandle': function (anEvent) { | 329 | 'initProgressHandle': function (anEvent) { |
334 | //console.log("** initProgressHandle", anEvent); | ||
335 | this._steps = anEvent['steps']; | 330 | this._steps = anEvent['steps']; |
336 | this._actualSteps = 0; | 331 | this._actualSteps = 0; |
337 | }, | 332 | }, |
338 | 333 | ||
339 | 'updateProgressHandle': function (anEvent) { | 334 | 'updateProgressHandle': function (anEvent) { |
340 | //console.log("** updateProgressHandle", anEvent); | ||
341 | this._steps += anEvent['extraSteps']; | 335 | this._steps += anEvent['extraSteps']; |
342 | }, | 336 | }, |
343 | 337 | ||
344 | 'advanceProgressHandle': function (anEvent) { | 338 | 'advanceProgressHandle': function (anEvent) { |
345 | //console.log("** advanceProgressHandle", anEvent); | ||
346 | this._actualSteps ++; | 339 | this._actualSteps ++; |
347 | //console.log("STEPS: " + this._actualSteps + "/" + this._steps); | ||
348 | }, | 340 | }, |
349 | 341 | ||
350 | 'progressDoneHandle': function (anEvent) { | 342 | 'progressDoneHandle': function (anEvent) { |
351 | //console.log("** progressDoneHandle", anEvent); | ||
352 | }, | 343 | }, |
353 | 344 | ||
354 | //------------------------------------------------------------------------- | 345 | //------------------------------------------------------------------------- |
355 | __syntaxFix__: "syntax fix" | 346 | __syntaxFix__: "syntax fix" |
356 | }); | 347 | }); |