summaryrefslogtreecommitdiff
path: root/frontend/gamma/js/Clipperz/PM/UI/Web/Components/UnlockPasswordComponent.js
Unidiff
Diffstat (limited to 'frontend/gamma/js/Clipperz/PM/UI/Web/Components/UnlockPasswordComponent.js') (more/less context) (show whitespace changes)
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Web/Components/UnlockPasswordComponent.js23
1 files changed, 10 insertions, 13 deletions
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/UnlockPasswordComponent.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/UnlockPasswordComponent.js
index 21ccf2a..fe46729 100644
--- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/UnlockPasswordComponent.js
+++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/UnlockPasswordComponent.js
@@ -1,70 +1,68 @@
1/* 1/*
2 2
3Copyright 2008-2011 Clipperz Srl 3Copyright 2008-2013 Clipperz Srl
4 4
5This file is part of Clipperz Community Edition. 5This file is part of Clipperz, the online password manager.
6Clipperz Community Edition is an online password manager.
7For further information about its features and functionalities please 6For further information about its features and functionalities please
8refer to http://www.clipperz.com. 7refer 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
26Clipperz.Base.module('Clipperz.PM.UI.Web.Components'); 24Clipperz.Base.module('Clipperz.PM.UI.Web.Components');
27 25
28Clipperz.PM.UI.Web.Components.UnlockPasswordComponent = function(args) { 26Clipperz.PM.UI.Web.Components.UnlockPasswordComponent = function(args) {
29 args = args || {}; 27 args = args || {};
30 28
31 Clipperz.PM.UI.Web.Components.UnlockPasswordComponent.superclass.constructor.apply(this, arguments); 29 Clipperz.PM.UI.Web.Components.UnlockPasswordComponent.superclass.constructor.apply(this, arguments);
32 30
33 this._openFromElement = args.openFromElement || null; 31 this._openFromElement = args.openFromElement || null;
34 this._onOkCloseToElement = args.onOkCloseToElement || null; 32 this._onOkCloseToElement = args.onOkCloseToElement || null;
35 this._onCancelCloseToElement = args.onCancelCloseToElement|| null; 33 this._onCancelCloseToElement = args.onCancelCloseToElement|| null;
36 34
37 this._progressBarComponent = null; 35 this._progressBarComponent = null;
38 36
39 return this; 37 return this;
40} 38}
41 39
42//============================================================================= 40//=============================================================================
43 41
44Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.UnlockPasswordComponent, Clipperz.PM.UI.Common.Components.SimpleMessagePanel, { 42Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.UnlockPasswordComponent, Clipperz.PM.UI.Common.Components.SimpleMessagePanel, {
45 43
46 //------------------------------------------------------------------------- 44 //-------------------------------------------------------------------------
47 45
48 'toString': function () { 46 'toString': function () {
49 return "Clipperz.PM.UI.Web.Components.UnlockPasswordComponent component"; 47 return "Clipperz.PM.UI.Web.Components.UnlockPasswordComponent component";
50 }, 48 },
51 49
52 //------------------------------------------------------------------------- 50 //-------------------------------------------------------------------------
53 51
54 'getPassphrase': function () { 52 'getPassphrase': function () {
55 /* var deferredResult; 53 /* var deferredResult;
56 54
57 if (this.passphrase() == null) { 55 if (this.passphrase() == null) {
58 this.deferredShowModal({'openFromElement': this.openFromElement()}); 56 this.deferredShowModal({'openFromElement': this.openFromElement()});
59 deferredResult = this.deferred(); 57 deferredResult = this.deferred();
60 } else { 58 } else {
61 deferredResult = MochiKit.Async.succeed(this.passphrase()); 59 deferredResult = MochiKit.Async.succeed(this.passphrase());
62 } 60 }
63 61
64 return deferredResult; 62 return deferredResult;
65*/ 63*/
66 64
67 this.deferredShowModal({'openFromElement': this.openFromElement()}); 65 this.deferredShowModal({'openFromElement': this.openFromElement()});
68 66
69 return this.deferred(); 67 return this.deferred();
70 }, 68 },
@@ -115,67 +113,66 @@ Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.UnlockPasswordComponent, Clip
115 //------------------------------------------------------------------------- 113 //-------------------------------------------------------------------------
116 114
117 'showProgressBar': function () { 115 'showProgressBar': function () {
118 varprogressBarElement; 116 varprogressBarElement;
119 117
120 this.getElement('container').innerHTML = ''; 118 this.getElement('container').innerHTML = '';
121 119
122 progressBarElement = this.append(this.getElement('container'), {tag:'div', cls:'progressBarWrapper'}); 120 progressBarElement = this.append(this.getElement('container'), {tag:'div', cls:'progressBarWrapper'});
123 this.addComponent(new Clipperz.PM.UI.Common.Components.ProgressBar({'element':progressBarElement})); 121 this.addComponent(new Clipperz.PM.UI.Common.Components.ProgressBar({'element':progressBarElement}));
124 122
125 this.setButtons([{text:"Cancel", result:'CANCEL'}]); 123 this.setButtons([{text:"Cancel", result:'CANCEL'}]);
126 }, 124 },
127 125
128 //------------------------------------------------------------------------- 126 //-------------------------------------------------------------------------
129 127
130 'showFailure': function () { 128 'showFailure': function () {
131 this.setType('ALERT'); 129 this.setType('ALERT');
132 this.setTitle("Login failed"); 130 this.setTitle("Login failed");
133 this.setText("Wrong passphrase; the unlock has failed."); 131 this.setText("Wrong passphrase; the unlock has failed.");
134 this.getElement('container').innerHTML = ''; 132 this.getElement('container').innerHTML = '';
135 this.setButtons([{text:"Close", result:'CANCEL', isDefault:true}]); 133 this.setButtons([{text:"Close", result:'CANCEL', isDefault:true}]);
136 }, 134 },
137 135
138 //------------------------------------------------------------------------- 136 //-------------------------------------------------------------------------
139 137
140 'closeOk': function () { 138 'closeOk': function () {
141 var passphrase; 139 var passphrase;
142 140
143 passphrase = this.getElement('passphrase').value; 141 passphrase = this.getElement('passphrase').value;
144 this.showProgressBar(); 142 this.showProgressBar();
145 // this.deferred().callback(passphrase); 143 // this.deferred().callback(passphrase);
146 MochiKit.Async.callLater(0.5, MochiKit.Base.method(this.deferred(), 'callback', passphrase)); 144 MochiKit.Async.callLater(0.5, MochiKit.Base.method(this.deferred(), 'callback', passphrase));
147 this._deferred = null; 145 this._deferred = null;
148 }, 146 },
149 147
150 'closeCancel': function () { 148 'closeCancel': function () {
151 this.deferredHideModal({closeToElement:this.onCancelCloseToElement()}); 149 this.deferredHideModal({closeToElement:this.onCancelCloseToElement()});
152 this.deferred().cancel(); 150 this.deferred().cancel();
153 this._deferred = null; 151 this._deferred = null;
154 }, 152 },
155 153
156 //------------------------------------------------------------------------- 154 //-------------------------------------------------------------------------
157 155
158 'userSuccessfullyLoggedInHandler': function (anEvent) { 156 'userSuccessfullyLoggedInHandler': function (anEvent) {
159 this.deferredHideModal({closeToElement:this.onOkCloseToElement()}); 157 this.deferredHideModal({closeToElement:this.onOkCloseToElement()});
160 }, 158 },
161 159
162 'userLoginFailedHandler': function (anEvent) { 160 'userLoginFailedHandler': function (anEvent) {
163//console.log("############### FAILED LOGIN ################");
164 this.showFailure(); 161 this.showFailure();
165 }, 162 },
166 163
167 //------------------------------------------------------------------------- 164 //-------------------------------------------------------------------------
168/* 165/*
169 'deferredShow': function (someArgs, aResult) { 166 'deferredShow': function (someArgs, aResult) {
170 this.deferredShowModal(someArgs); 167 this.deferredShowModal(someArgs);
171 168
172 // this.deferred().addMethod(this, 'deferredHideModal', {closeToElement:someArgs.onOkCloseToElement }); 169 // this.deferred().addMethod(this, 'deferredHideModal', {closeToElement:someArgs.onOkCloseToElement });
173 // this.deferred().addErrback (MochiKit.Base.method(this, 'deferredHideModal', {closeToElement:someArgs.onCancelCloseToElement })); 170 // this.deferred().addErrback (MochiKit.Base.method(this, 'deferredHideModal', {closeToElement:someArgs.onCancelCloseToElement }));
174 // this.deferred().addCallback(MochiKit.Async.succeed, aResult); 171 // this.deferred().addCallback(MochiKit.Async.succeed, aResult);
175 172
176 return this.deferred(); 173 return this.deferred();
177 }, 174 },
178*/ 175*/
179 //------------------------------------------------------------------------- 176 //-------------------------------------------------------------------------
180 __syntaxFix__: "syntax fix" 177 __syntaxFix__: "syntax fix"
181}); 178});