summaryrefslogtreecommitdiff
authorGiulio Cesare Solaroli <giulio.cesare@clipperz.com>2014-05-02 15:14:18 (UTC)
committer Giulio Cesare Solaroli <giulio.cesare@clipperz.com>2014-05-02 15:24:45 (UTC)
commited6b4edc82b0f65c77980713cd525053fcbc1dd2 (patch) (unidiff)
tree80eb0e6ccfc4efa15c6488cc83448d8a865169df
parent03659f6b3d9766898854e8a769c0c9341b3de80c (diff)
downloadclipperz-ed6b4edc82b0f65c77980713cd525053fcbc1dd2.zip
clipperz-ed6b4edc82b0f65c77980713cd525053fcbc1dd2.tar.gz
clipperz-ed6b4edc82b0f65c77980713cd525053fcbc1dd2.tar.bz2
Fixed issues reported by cure53.de
Fixed issues CLP-01-014 and CLP-01-015
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--frontend/beta/js/Clipperz/Base.js28
-rw-r--r--frontend/beta/js/Clipperz/PM/BookmarkletProcessor.js2
-rw-r--r--frontend/beta/js/Clipperz/PM/Components/RecordDetail/DirectLoginBindingComponent.js4
-rw-r--r--frontend/beta/js/Clipperz/PM/DataModel/DirectLogin.js22
-rw-r--r--frontend/beta/js/Clipperz/PM/DataModel/DirectLoginReference.js2
5 files changed, 47 insertions, 11 deletions
diff --git a/frontend/beta/js/Clipperz/Base.js b/frontend/beta/js/Clipperz/Base.js
index cf40314..1c6faa1 100644
--- a/frontend/beta/js/Clipperz/Base.js
+++ b/frontend/beta/js/Clipperz/Base.js
@@ -57,247 +57,275 @@ MochiKit.Base.update(Clipperz.Base, {
57 57
58 c = aValue.length; 58 c = aValue.length;
59 for (i=0; i<c; i++) { 59 for (i=0; i<c; i++) {
60 result[i] = aValue.charCodeAt(i); 60 result[i] = aValue.charCodeAt(i);
61 } 61 }
62 62
63 return result; 63 return result;
64 }, 64 },
65 65
66 //......................................................................... 66 //.........................................................................
67 67
68 'byteArrayToString': function (anArrayOfBytes) { 68 'byteArrayToString': function (anArrayOfBytes) {
69 varresult; 69 varresult;
70 var i, c; 70 var i, c;
71 71
72 result = ""; 72 result = "";
73 73
74 c = anArrayOfBytes.length; 74 c = anArrayOfBytes.length;
75 for (i=0; i<c; i++) { 75 for (i=0; i<c; i++) {
76 result += String.fromCharCode(anArrayOfBytes[i]); 76 result += String.fromCharCode(anArrayOfBytes[i]);
77 } 77 }
78 78
79 return result; 79 return result;
80 }, 80 },
81 81
82 //------------------------------------------------------------------------- 82 //-------------------------------------------------------------------------
83 83
84 'getValueForKeyInFormContent': function (aFormContent, aKey) { 84 'getValueForKeyInFormContent': function (aFormContent, aKey) {
85 return aFormContent[1][MochiKit.Base.find(aFormContent[0], aKey)]; 85 return aFormContent[1][MochiKit.Base.find(aFormContent[0], aKey)];
86 }, 86 },
87 87
88 //------------------------------------------------------------------------- 88 //-------------------------------------------------------------------------
89 89
90 'indexOfObjectInArray': function(anObject, anArray) { 90 'indexOfObjectInArray': function(anObject, anArray) {
91 varresult; 91 varresult;
92 vari, c; 92 vari, c;
93 93
94 result = -1; 94 result = -1;
95 95
96 c = anArray.length; 96 c = anArray.length;
97 for (i=0; ((i<c) && (result < 0)); i++) { 97 for (i=0; ((i<c) && (result < 0)); i++) {
98 if (anArray[i] === anObject) { 98 if (anArray[i] === anObject) {
99 result = i; 99 result = i;
100 } 100 }
101 } 101 }
102 102
103 return result; 103 return result;
104 }, 104 },
105 105
106 'removeObjectAtIndexFromArray': function(anIndex, anArray) { 106 'removeObjectAtIndexFromArray': function(anIndex, anArray) {
107 anArray.splice(anIndex, 1); 107 anArray.splice(anIndex, 1);
108 }, 108 },
109 109
110 'removeObjectFromArray': function(anObject, anArray) { 110 'removeObjectFromArray': function(anObject, anArray) {
111 varobjectIndex; 111 varobjectIndex;
112 112
113 objectIndex = Clipperz.Base.indexOfObjectInArray(anObject, anArray); 113 objectIndex = Clipperz.Base.indexOfObjectInArray(anObject, anArray);
114 if (objectIndex > -1) { 114 if (objectIndex > -1) {
115 Clipperz.Base.removeObjectAtIndexFromArray(objectIndex, anArray); 115 Clipperz.Base.removeObjectAtIndexFromArray(objectIndex, anArray);
116 } else { 116 } else {
117 // jslog.error("Trying to remove an object not present in the array"); 117 // jslog.error("Trying to remove an object not present in the array");
118 //TODO: raise an exception 118 //TODO: raise an exception
119 } 119 }
120 }, 120 },
121 121
122 'removeFromArray': function(anArray, anObject) { 122 'removeFromArray': function(anArray, anObject) {
123 return Clipperz.Base.removeObjectFromArray(anObject, anArray); 123 return Clipperz.Base.removeObjectFromArray(anObject, anArray);
124 }, 124 },
125 125
126 //------------------------------------------------------------------------- 126 //-------------------------------------------------------------------------
127 127
128 'splitStringAtFixedTokenSize': function(aString, aTokenSize) { 128 'splitStringAtFixedTokenSize': function(aString, aTokenSize) {
129 var result; 129 var result;
130 varstringToProcess; 130 varstringToProcess;
131 131
132 stringToProcess = aString; 132 stringToProcess = aString;
133 result = []; 133 result = [];
134 if (stringToProcess != null) { 134 if (stringToProcess != null) {
135 while (stringToProcess.length > aTokenSize) { 135 while (stringToProcess.length > aTokenSize) {
136 result.push(stringToProcess.substring(0, aTokenSize)); 136 result.push(stringToProcess.substring(0, aTokenSize));
137 stringToProcess = stringToProcess.substring(aTokenSize); 137 stringToProcess = stringToProcess.substring(aTokenSize);
138 } 138 }
139 139
140 result.push(stringToProcess); 140 result.push(stringToProcess);
141 } 141 }
142 142
143 return result; 143 return result;
144 }, 144 },
145 145
146 //------------------------------------------------------------------------- 146 //-------------------------------------------------------------------------
147 147
148 'objectType': function(anObject) { 148 'objectType': function(anObject) {
149 var result; 149 var result;
150 150
151 if (anObject == null) { 151 if (anObject == null) {
152 result = null; 152 result = null;
153 } else { 153 } else {
154 result = typeof(anObject); 154 result = typeof(anObject);
155 155
156 if (result == "object") { 156 if (result == "object") {
157 if (anObject instanceof Array) { 157 if (anObject instanceof Array) {
158 result = 'array' 158 result = 'array'
159 } else if (anObject.constructor == Boolean) { 159 } else if (anObject.constructor == Boolean) {
160 result = 'boolean' 160 result = 'boolean'
161 } else if (anObject instanceof Date) { 161 } else if (anObject instanceof Date) {
162 result = 'date' 162 result = 'date'
163 } else if (anObject instanceof Error) { 163 } else if (anObject instanceof Error) {
164 result = 'error' 164 result = 'error'
165 } else if (anObject instanceof Function) { 165 } else if (anObject instanceof Function) {
166 result = 'function' 166 result = 'function'
167 } else if (anObject.constructor == Number) { 167 } else if (anObject.constructor == Number) {
168 result = 'number' 168 result = 'number'
169 } else if (anObject.constructor == String) { 169 } else if (anObject.constructor == String) {
170 result = 'string' 170 result = 'string'
171 } else if (anObject instanceof Object) { 171 } else if (anObject instanceof Object) {
172 result = 'object' 172 result = 'object'
173 } else { 173 } else {
174 throw Clipperz.Base.exception.UnknownType; 174 throw Clipperz.Base.exception.UnknownType;
175 } 175 }
176 } 176 }
177 } 177 }
178 178
179 return result; 179 return result;
180 }, 180 },
181 181
182 //------------------------------------------------------------------------- 182 //-------------------------------------------------------------------------
183 183
184 'escapeHTML': function(aValue) { 184 'escapeHTML': function(aValue) {
185 var result; 185 var result;
186 186
187 result = aValue; 187 result = aValue;
188 result = result.replace(/</g, "&lt;"); 188 result = result.replace(/</g, "&lt;");
189 result = result.replace(/>/g, "&gt;"); 189 result = result.replace(/>/g, "&gt;");
190 190
191 return result; 191 return result;
192 }, 192 },
193 193
194 //------------------------------------------------------------------------- 194 //-------------------------------------------------------------------------
195 195
196 'deepClone': function(anObject) { 196 'deepClone': function(anObject) {
197 var result; 197 var result;
198 198
199 result = Clipperz.Base.evalJSON(Clipperz.Base.serializeJSON(anObject)); 199 result = Clipperz.Base.evalJSON(Clipperz.Base.serializeJSON(anObject));
200 200
201 return result; 201 return result;
202 }, 202 },
203 203
204 //------------------------------------------------------------------------- 204 //-------------------------------------------------------------------------
205 205
206 'evalJSON': function(aString) { 206 'evalJSON': function(aString) {
207/* 207/*
208 var result; 208 var result;
209 209
210 //check for XSS injection 210 //check for XSS injection
211 if (/<script>/.test(aString)) { 211 if (/<script>/.test(aString)) {
212 throw "error"; 212 throw "error";
213 } 213 }
214 214
215 if (/<iframe>/.test(aString)) { 215 if (/<iframe>/.test(aString)) {
216 throw "error"; 216 throw "error";
217 } 217 }
218 218
219 result = MochiKit.Base.evalJSON(aString); 219 result = MochiKit.Base.evalJSON(aString);
220 220
221 return result; 221 return result;
222*/ 222*/
223 223
224 // return MochiKit.Base.evalJSON(aString); 224 // return MochiKit.Base.evalJSON(aString);
225 return JSON2.parse(aString); 225 return JSON2.parse(aString);
226 }, 226 },
227 227
228 'serializeJSON': function(anObject) { 228 'serializeJSON': function(anObject) {
229 // return MochiKit.Base.serializeJSON(anObject); 229 // return MochiKit.Base.serializeJSON(anObject);
230 return JSON2.stringify(anObject); 230 return JSON2.stringify(anObject);
231 }, 231 },
232 232
233 //------------------------------------------------------------------------- 233 //-------------------------------------------------------------------------
234 234
235 'sanitizeString': function(aValue) { 235 'sanitizeString': function(aValue) {
236 var result; 236 var result;
237 237
238 if (Clipperz.Base.objectType(aValue) == 'string') { 238 if (Clipperz.Base.objectType(aValue) == 'string') {
239 result = aValue; 239 result = aValue;
240 result = result.replace(/</img,"&lt;"); 240 result = result.replace(/</img,"&lt;");
241 result = result.replace(/>/img,"&gt;"); 241 result = result.replace(/>/img,"&gt;");
242 } else { 242 } else {
243 result = aValue; 243 result = aValue;
244 } 244 }
245 245
246 return result; 246 return result;
247 }, 247 },
248 248
249 'javascriptInjectionPattern': new RegExp("javascript:\/\/\"", "g"),
250
251 'sanitizeUrl': function(aValue) {
252 varresult;
253
254 if ((aValue != null) && this.javascriptInjectionPattern.test(aValue)) {
255 result = aValue.replace(this.javascriptInjectionPattern, '');
256 console.log("sanitized url", aValue, result);
257 } else {
258 result = aValue;
259 }
260
261 return result;
262 },
263
264 'sanitizeFavicon': function(aValue) {
265 varresult;
266
267 if ((aValue != null) && this.javascriptInjectionPattern.test(aValue)) {
268 result = aValue.replace(this.javascriptInjectionPattern, '');
269 console.log("sanitized favicon", aValue, result);
270 } else {
271 result = aValue;
272 }
273
274 return result;
275 },
276
249 //------------------------------------------------------------------------- 277 //-------------------------------------------------------------------------
250 278
251 'exception': { 279 'exception': {
252 'AbstractMethod': new MochiKit.Base.NamedError("Clipperz.Base.exception.AbstractMethod"), 280 'AbstractMethod': new MochiKit.Base.NamedError("Clipperz.Base.exception.AbstractMethod"),
253 'UnknownType': new MochiKit.Base.NamedError("Clipperz.Base.exception.UnknownType"), 281 'UnknownType': new MochiKit.Base.NamedError("Clipperz.Base.exception.UnknownType"),
254 'VulnerabilityIssue':new MochiKit.Base.NamedError("Clipperz.Base.exception.VulnerabilityIssue") 282 'VulnerabilityIssue':new MochiKit.Base.NamedError("Clipperz.Base.exception.VulnerabilityIssue")
255 }, 283 },
256 284
257 //------------------------------------------------------------------------- 285 //-------------------------------------------------------------------------
258 __syntaxFix__: "syntax fix" 286 __syntaxFix__: "syntax fix"
259 287
260}); 288});
261 289
262 290
263 291
264MochiKit.Base.registerComparator('Object dummy comparator', 292MochiKit.Base.registerComparator('Object dummy comparator',
265 function(a, b) { 293 function(a, b) {
266 return ((a.constructor == Object) && (b.constructor == Object)); 294 return ((a.constructor == Object) && (b.constructor == Object));
267 }, 295 },
268 function(a, b) { 296 function(a, b) {
269 var result; 297 var result;
270 var aKeys; 298 var aKeys;
271 var bKeys; 299 var bKeys;
272 300
273//MochiKit.Logging.logDebug(">>> comparator"); 301//MochiKit.Logging.logDebug(">>> comparator");
274//MochiKit.Logging.logDebug("- a: " + Clipperz.Base.serializeJSON(a)); 302//MochiKit.Logging.logDebug("- a: " + Clipperz.Base.serializeJSON(a));
275//MochiKit.Logging.logDebug("- b: " + Clipperz.Base.serializeJSON(a)); 303//MochiKit.Logging.logDebug("- b: " + Clipperz.Base.serializeJSON(a));
276 aKeys = MochiKit.Base.keys(a).sort(); 304 aKeys = MochiKit.Base.keys(a).sort();
277 bKeys = MochiKit.Base.keys(b).sort(); 305 bKeys = MochiKit.Base.keys(b).sort();
278 306
279 result = MochiKit.Base.compare(aKeys, bKeys); 307 result = MochiKit.Base.compare(aKeys, bKeys);
280//if (result != 0) { 308//if (result != 0) {
281 //MochiKit.Logging.logDebug("- comparator 'keys':"); 309 //MochiKit.Logging.logDebug("- comparator 'keys':");
282 //MochiKit.Logging.logDebug("- comparator aKeys: " + Clipperz.Base.serializeJSON(aKeys)); 310 //MochiKit.Logging.logDebug("- comparator aKeys: " + Clipperz.Base.serializeJSON(aKeys));
283 //MochiKit.Logging.logDebug("- comparator bKeys: " + Clipperz.Base.serializeJSON(bKeys)); 311 //MochiKit.Logging.logDebug("- comparator bKeys: " + Clipperz.Base.serializeJSON(bKeys));
284//} 312//}
285 if (result == 0) { 313 if (result == 0) {
286 vari, c; 314 vari, c;
287 315
288 c = aKeys.length; 316 c = aKeys.length;
289 for (i=0; (i<c) && (result == 0); i++) { 317 for (i=0; (i<c) && (result == 0); i++) {
290 result = MochiKit.Base.compare(a[aKeys[i]], b[bKeys[i]]); 318 result = MochiKit.Base.compare(a[aKeys[i]], b[bKeys[i]]);
291//if (result != 0) { 319//if (result != 0) {
292 //MochiKit.Logging.logDebug("- comparator 'values':"); 320 //MochiKit.Logging.logDebug("- comparator 'values':");
293 //MochiKit.Logging.logDebug("- comparator a[aKeys[i]]: " + Clipperz.Base.serializeJSON(a[aKeys[i]])); 321 //MochiKit.Logging.logDebug("- comparator a[aKeys[i]]: " + Clipperz.Base.serializeJSON(a[aKeys[i]]));
294 //MochiKit.Logging.logDebug("- comparator b[bKeys[i]]: " + Clipperz.Base.serializeJSON(b[bKeys[i]])); 322 //MochiKit.Logging.logDebug("- comparator b[bKeys[i]]: " + Clipperz.Base.serializeJSON(b[bKeys[i]]));
295//} 323//}
296 } 324 }
297 } 325 }
298 326
299//MochiKit.Logging.logDebug("<<< comparator - result: " + result); 327//MochiKit.Logging.logDebug("<<< comparator - result: " + result);
300 return result; 328 return result;
301 }, 329 },
302 true 330 true
303); 331);
diff --git a/frontend/beta/js/Clipperz/PM/BookmarkletProcessor.js b/frontend/beta/js/Clipperz/PM/BookmarkletProcessor.js
index 2295d3f..369b9ce 100644
--- a/frontend/beta/js/Clipperz/PM/BookmarkletProcessor.js
+++ b/frontend/beta/js/Clipperz/PM/BookmarkletProcessor.js
@@ -1,283 +1,283 @@
1/* 1/*
2 2
3Copyright 2008-2013 Clipperz Srl 3Copyright 2008-2013 Clipperz Srl
4 4
5This file is part of Clipperz, the online password manager. 5This file is part of Clipperz, the online password manager.
6For further information about its features and functionalities please 6For further information about its features and functionalities please
7refer to http://www.clipperz.com. 7refer to http://www.clipperz.com.
8 8
9* Clipperz is free software: you can redistribute it and/or modify it 9* Clipperz is free software: you can redistribute it and/or modify it
10 under the terms of the GNU Affero General Public License as published 10 under the terms of the GNU Affero General Public License as published
11 by the Free Software Foundation, either version 3 of the License, or 11 by the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version. 12 (at your option) any later version.
13 13
14* Clipperz is distributed in the hope that it will be useful, but 14* Clipperz is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of 15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17 See the GNU Affero General Public License for more details. 17 See the GNU Affero General Public License for more details.
18 18
19* 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
20 License along with Clipperz. If not, see http://www.gnu.org/licenses/. 20 License along with Clipperz. If not, see http://www.gnu.org/licenses/.
21 21
22*/ 22*/
23 23
24if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } 24if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
25if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } 25if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
26//if (typeof(Clipperz.PM.BookmarkletProcessor) == 'undefined') { Clipperz.PM.BookmarkletProcessor = {}; } 26//if (typeof(Clipperz.PM.BookmarkletProcessor) == 'undefined') { Clipperz.PM.BookmarkletProcessor = {}; }
27//if (typeof(Clipperz.PM.BookmarkletProcessor.versions) == 'undefined') { Clipperz.PM.BookmarkletProcessor.versions = {}; } 27//if (typeof(Clipperz.PM.BookmarkletProcessor.versions) == 'undefined') { Clipperz.PM.BookmarkletProcessor.versions = {}; }
28 28
29/* 29/*
30Clipperz.PM.BookmarkletProcessor.versions['abstract'] = function(anUser, aConfiguration) { 30Clipperz.PM.BookmarkletProcessor.versions['abstract'] = function(anUser, aConfiguration) {
31 this._user = anUser; 31 this._user = anUser;
32 this._configuration = aConfiguration; 32 this._configuration = aConfiguration;
33 33
34 this._recordTitle = null; 34 this._recordTitle = null;
35 this._record = null; 35 this._record = null;
36 this._editableFields = null; 36 this._editableFields = null;
37 37
38 return this; 38 return this;
39} 39}
40 40
41 41
42Clipperz.PM.BookmarkletProcessor.versions['abstract'].prototype = MochiKit.Base.update(null, { 42Clipperz.PM.BookmarkletProcessor.versions['abstract'].prototype = MochiKit.Base.update(null, {
43 43
44 'toString': function() { 44 'toString': function() {
45 return "BookmarkletProcessor - " + this.user(); 45 return "BookmarkletProcessor - " + this.user();
46 }, 46 },
47 47
48 //------------------------------------------------------------------------- 48 //-------------------------------------------------------------------------
49 49
50 'user': function() { 50 'user': function() {
51 return this._user; 51 return this._user;
52 }, 52 },
53 53
54 //------------------------------------------------------------------------- 54 //-------------------------------------------------------------------------
55 55
56 'configuration': function() { 56 'configuration': function() {
57 return this._configuration; 57 return this._configuration;
58 }, 58 },
59 59
60 //------------------------------------------------------------------------- 60 //-------------------------------------------------------------------------
61 61
62 'record': function() { 62 'record': function() {
63 throw Clipperz.Base.exception.AbstractMethod; 63 throw Clipperz.Base.exception.AbstractMethod;
64 }, 64 },
65 65
66 //------------------------------------------------------------------------- 66 //-------------------------------------------------------------------------
67 __syntaxFix__: "syntax fix" 67 __syntaxFix__: "syntax fix"
68}); 68});
69*/ 69*/
70 70
71Clipperz.PM.BookmarkletProcessor = function(anUser, aConfiguration) { 71Clipperz.PM.BookmarkletProcessor = function(anUser, aConfiguration) {
72 this._user = anUser; 72 this._user = anUser;
73 this._configuration = aConfiguration; 73 this._configuration = aConfiguration;
74 74
75 this._recordTitle = null; 75 this._recordTitle = null;
76 this._record = null; 76 this._record = null;
77 this._editableFields = null; 77 this._editableFields = null;
78 this._favicon = null; 78 this._favicon = null;
79 79
80 return this; 80 return this;
81} 81}
82 82
83Clipperz.PM.BookmarkletProcessor.prototype = MochiKit.Base.update(null, { 83Clipperz.PM.BookmarkletProcessor.prototype = MochiKit.Base.update(null, {
84 84
85 'toString': function() { 85 'toString': function() {
86 return "BookmarkletProcessor - " + this.user(); 86 return "BookmarkletProcessor - " + this.user();
87 }, 87 },
88 88
89 //------------------------------------------------------------------------- 89 //-------------------------------------------------------------------------
90 90
91 'user': function() { 91 'user': function() {
92 return this._user; 92 return this._user;
93 }, 93 },
94 94
95 //------------------------------------------------------------------------- 95 //-------------------------------------------------------------------------
96 96
97 'configuration': function() { 97 'configuration': function() {
98 return this._configuration; 98 return this._configuration;
99 }, 99 },
100 100
101 //------------------------------------------------------------------------- 101 //-------------------------------------------------------------------------
102 102
103 'recordTitle': function() { 103 'recordTitle': function() {
104 if (this._recordTitle == null) { 104 if (this._recordTitle == null) {
105 this._recordTitle = this.configuration().page.title; 105 this._recordTitle = this.configuration().page.title;
106 } 106 }
107 107
108 return this._recordTitle; 108 return this._recordTitle;
109 }, 109 },
110 110
111 //------------------------------------------------------------------------- 111 //-------------------------------------------------------------------------
112 112
113 'fields': function() { 113 'fields': function() {
114 return this.configuration().form.inputs; 114 return this.configuration().form.inputs;
115 }, 115 },
116 116
117 //------------------------------------------------------------------------- 117 //-------------------------------------------------------------------------
118 118
119 'editableFields': function() { 119 'editableFields': function() {
120 if (this._editableFields == null) { 120 if (this._editableFields == null) {
121 this._editableFields = MochiKit.Base.filter(function(aField) { 121 this._editableFields = MochiKit.Base.filter(function(aField) {
122 var result; 122 var result;
123 var type; 123 var type;
124 124
125 type = aField['type'].toLowerCase(); 125 type = aField['type'].toLowerCase();
126 result = ((type != 'hidden') && (type != 'submit') && (type != 'checkbox') && (type != 'radio') && (type != 'select')); 126 result = ((type != 'hidden') && (type != 'submit') && (type != 'checkbox') && (type != 'radio') && (type != 'select'));
127 127
128 return result; 128 return result;
129 }, this.fields()) 129 }, this.fields())
130 } 130 }
131 131
132 return this._editableFields; 132 return this._editableFields;
133 }, 133 },
134 134
135 //------------------------------------------------------------------------- 135 //-------------------------------------------------------------------------
136 136
137 'hostname': function() { 137 'hostname': function() {
138 if (this._hostname == null) { 138 if (this._hostname == null) {
139 var actionUrl; 139 var actionUrl;
140 140
141 actionUrl = this.configuration()['form']['attributes']['action']; 141 actionUrl = Clipperz.Base.sanitizeUrl(this.configuration()['form']['attributes']['action']);
142//MochiKit.Logging.logDebug("+++ actionUrl: " + actionUrl); 142//MochiKit.Logging.logDebug("+++ actionUrl: " + actionUrl);
143 this._hostname = actionUrl.replace(/^https?:\/\/([^\/]*)\/.*/, '$1'); 143 this._hostname = actionUrl.replace(/^https?:\/\/([^\/]*)\/.*/, '$1');
144 } 144 }
145 145
146 return this._hostname; 146 return this._hostname;
147 }, 147 },
148 148
149 'favicon': function() { 149 'favicon': function() {
150 if (this._favicon == null) { 150 if (this._favicon == null) {
151 this._favicon = "http://" + this.hostname() + "/favicon.ico"; 151 this._favicon = "http://" + this.hostname() + "/favicon.ico";
152//MochiKit.Logging.logDebug("+++ favicon: " + this._favicon); 152//MochiKit.Logging.logDebug("+++ favicon: " + this._favicon);
153 } 153 }
154 154
155 return this._favicon; 155 return this._favicon;
156 }, 156 },
157 157
158 //------------------------------------------------------------------------- 158 //-------------------------------------------------------------------------
159 159
160 'record': function() { 160 'record': function() {
161 if (this._record == null) { 161 if (this._record == null) {
162 var record; 162 var record;
163 var recordVersion; 163 var recordVersion;
164 var directLogin; 164 var directLogin;
165 var bindings; 165 var bindings;
166 var i,c; 166 var i,c;
167 167
168 record = new Clipperz.PM.DataModel.Record({ 168 record = new Clipperz.PM.DataModel.Record({
169 label:this.recordTitle(), 169 label:this.recordTitle(),
170 notes:"", 170 notes:"",
171 user:this.user() 171 user:this.user()
172 }); 172 });
173 recordVersion = new Clipperz.PM.DataModel.RecordVersion(record, {}) 173 recordVersion = new Clipperz.PM.DataModel.RecordVersion(record, {})
174 record.setCurrentVersion(recordVersion); 174 record.setCurrentVersion(recordVersion);
175 175
176 bindings = {}; 176 bindings = {};
177 177
178 c = this.editableFields().length; 178 c = this.editableFields().length;
179 for (i=0; i<c; i++) { 179 for (i=0; i<c; i++) {
180 var formField; 180 var formField;
181 var recordField; 181 var recordField;
182 182
183//MochiKit.Logging.logDebug(">>> adding a field"); 183//MochiKit.Logging.logDebug(">>> adding a field");
184 formField = this.editableFields()[i]; 184 formField = this.editableFields()[i];
185 recordField = new Clipperz.PM.DataModel.RecordField({ 185 recordField = new Clipperz.PM.DataModel.RecordField({
186 recordVersion:recordVersion, 186 recordVersion:recordVersion,
187 label:formField['name'], 187 label:formField['name'],
188 value:formField['value'], 188 value:formField['value'],
189 type:Clipperz.PM.Strings.inputTypeToRecordFieldType[formField['type']], 189 type:Clipperz.PM.Strings.inputTypeToRecordFieldType[formField['type']],
190 hidden:false 190 hidden:false
191 }); 191 });
192 recordVersion.addField(recordField); 192 recordVersion.addField(recordField);
193 193
194 bindings[formField['name']] = recordField.key(); 194 bindings[formField['name']] = recordField.key();
195//MochiKit.Logging.logDebug("<<< adding a field"); 195//MochiKit.Logging.logDebug("<<< adding a field");
196 } 196 }
197 197
198 directLogin = new Clipperz.PM.DataModel.DirectLogin({ 198 directLogin = new Clipperz.PM.DataModel.DirectLogin({
199 record:record, 199 record:record,
200 label:this.recordTitle() + Clipperz.PM.Strings['newDirectLoginLabelSuffix'], 200 label:this.recordTitle() + Clipperz.PM.Strings['newDirectLoginLabelSuffix'],
201 // bookmarkletVersion:this.version(), 201 // bookmarkletVersion:this.version(),
202 bookmarkletVersion:'0.2', 202 bookmarkletVersion:'0.2',
203 favicon:this.favicon(), 203 favicon:this.favicon(),
204 formData:this.configuration()['form'], 204 formData:this.configuration()['form'],
205 bindingData:bindings 205 bindingData:bindings
206 }); 206 });
207 record.addDirectLogin(directLogin); 207 record.addDirectLogin(directLogin);
208 208
209 this.user().addRecord(record); 209 this.user().addRecord(record);
210 210
211 this._record = record; 211 this._record = record;
212 } 212 }
213 213
214 return this._record; 214 return this._record;
215 }, 215 },
216 216
217 //------------------------------------------------------------------------- 217 //-------------------------------------------------------------------------
218 __syntaxFix__: "syntax fix" 218 __syntaxFix__: "syntax fix"
219}); 219});
220 220
221//############################################################################# 221//#############################################################################
222 222
223Clipperz.PM.BookmarkletProcessor.createRecordFromBookmarkletConfiguration = function(anUser, aConfiguration) { 223Clipperz.PM.BookmarkletProcessor.createRecordFromBookmarkletConfiguration = function(anUser, aConfiguration) {
224 var processor; 224 var processor;
225 225
226 processor = new Clipperz.PM.BookmarkletProcessor(anUser, aConfiguration); 226 processor = new Clipperz.PM.BookmarkletProcessor(anUser, aConfiguration);
227 227
228 return processor.record(); 228 return processor.record();
229}; 229};
230 230
231//----------------------------------------------------------------------------- 231//-----------------------------------------------------------------------------
232 232
233Clipperz.PM.BookmarkletProcessor.sanitizeBookmarkletConfiguration = function(aConfiguration) { 233Clipperz.PM.BookmarkletProcessor.sanitizeBookmarkletConfiguration = function(aConfiguration) {
234 var result; 234 var result;
235 235
236 //throw "XSS Bookmarklet attempt"; 236 //throw "XSS Bookmarklet attempt";
237 237
238 result = aConfiguration; 238 result = aConfiguration;
239 239
240 return result; 240 return result;
241}; 241};
242 242
243//----------------------------------------------------------------------------- 243//-----------------------------------------------------------------------------
244 244
245Clipperz.PM.BookmarkletProcessor.checkBookmarkletConfiguration = function(aConfiguration, aButton, aCallback) { 245Clipperz.PM.BookmarkletProcessor.checkBookmarkletConfiguration = function(aConfiguration, aButton, aCallback) {
246 var result; 246 var result;
247 247
248 try { 248 try {
249 result = Clipperz.Base.evalJSON(aConfiguration); 249 result = Clipperz.Base.evalJSON(aConfiguration);
250 result = Clipperz.PM.BookmarkletProcessor.sanitizeBookmarkletConfiguration(result); 250 result = Clipperz.PM.BookmarkletProcessor.sanitizeBookmarkletConfiguration(result);
251 251
252 if (result['version'] != '0.2.3') { 252 if (result['version'] != '0.2.3') {
253 throw "WrongBookmarkletVersion"; 253 throw "WrongBookmarkletVersion";
254 } 254 }
255 } catch (exception) { 255 } catch (exception) {
256 var title; 256 var title;
257 var message; 257 var message;
258 258
259 if (exception == "WrongBookmarkletVersion") { 259 if (exception == "WrongBookmarkletVersion") {
260 title = Clipperz.PM.Strings['newRecordPanelWrongBookmarkletVersionExceptionTitle']; 260 title = Clipperz.PM.Strings['newRecordPanelWrongBookmarkletVersionExceptionTitle'];
261 message = Clipperz.PM.Strings['newRecordPanelWrongBookmarkletVersionExceptionMessage']; 261 message = Clipperz.PM.Strings['newRecordPanelWrongBookmarkletVersionExceptionMessage'];
262 } else { 262 } else {
263 title = Clipperz.PM.Strings['newRecordPanelGeneralExceptionTitle']; 263 title = Clipperz.PM.Strings['newRecordPanelGeneralExceptionTitle'];
264 message = Clipperz.PM.Strings['newRecordPanelGeneralExceptionMessage']; 264 message = Clipperz.PM.Strings['newRecordPanelGeneralExceptionMessage'];
265 } 265 }
266 Clipperz.PM.Components.MessageBox().show({ 266 Clipperz.PM.Components.MessageBox().show({
267 title:title, 267 title:title,
268 text:message, 268 text:message,
269 width:240, 269 width:240,
270 fn:aCallback, 270 fn:aCallback,
271 closable:false, 271 closable:false,
272 showProgressBar:false, 272 showProgressBar:false,
273 showCloseButton:false, 273 showCloseButton:false,
274 buttons:{'ok':Clipperz.PM.Strings['newRecordPanelExceptionPanelCloseButtonLabel']} 274 buttons:{'ok':Clipperz.PM.Strings['newRecordPanelExceptionPanelCloseButtonLabel']}
275 }, aButton); 275 }, aButton);
276 276
277 throw exception; 277 throw exception;
278 } 278 }
279 279
280 return result; 280 return result;
281}; 281};
282 282
283//----------------------------------------------------------------------------- 283//-----------------------------------------------------------------------------
diff --git a/frontend/beta/js/Clipperz/PM/Components/RecordDetail/DirectLoginBindingComponent.js b/frontend/beta/js/Clipperz/PM/Components/RecordDetail/DirectLoginBindingComponent.js
index 0e4640e..a5a4697 100644
--- a/frontend/beta/js/Clipperz/PM/Components/RecordDetail/DirectLoginBindingComponent.js
+++ b/frontend/beta/js/Clipperz/PM/Components/RecordDetail/DirectLoginBindingComponent.js
@@ -1,169 +1,169 @@
1/* 1/*
2 2
3Copyright 2008-2013 Clipperz Srl 3Copyright 2008-2013 Clipperz Srl
4 4
5This file is part of Clipperz, the online password manager. 5This file is part of Clipperz, the online password manager.
6For further information about its features and functionalities please 6For further information about its features and functionalities please
7refer to http://www.clipperz.com. 7refer to http://www.clipperz.com.
8 8
9* Clipperz is free software: you can redistribute it and/or modify it 9* Clipperz is free software: you can redistribute it and/or modify it
10 under the terms of the GNU Affero General Public License as published 10 under the terms of the GNU Affero General Public License as published
11 by the Free Software Foundation, either version 3 of the License, or 11 by the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version. 12 (at your option) any later version.
13 13
14* Clipperz is distributed in the hope that it will be useful, but 14* Clipperz is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of 15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17 See the GNU Affero General Public License for more details. 17 See the GNU Affero General Public License for more details.
18 18
19* 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
20 License along with Clipperz. If not, see http://www.gnu.org/licenses/. 20 License along with Clipperz. If not, see http://www.gnu.org/licenses/.
21 21
22*/ 22*/
23 23
24if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } 24if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
25if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } 25if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
26if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; } 26if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; }
27if (typeof(Clipperz.PM.Components.RecordDetail) == 'undefined') { Clipperz.PM.Components.RecordDetail = {}; } 27if (typeof(Clipperz.PM.Components.RecordDetail) == 'undefined') { Clipperz.PM.Components.RecordDetail = {}; }
28 28
29//############################################################################# 29//#############################################################################
30 30
31Clipperz.PM.Components.RecordDetail.DirectLoginBindingComponent = function(anElement, args) { 31Clipperz.PM.Components.RecordDetail.DirectLoginBindingComponent = function(anElement, args) {
32//MochiKit.Logging.logDebug(">>> new DirectLoginBindingComponent"); 32//MochiKit.Logging.logDebug(">>> new DirectLoginBindingComponent");
33 args = args || {}; 33 args = args || {};
34 34
35 Clipperz.PM.Components.RecordDetail.DirectLoginBindingComponent.superclass.constructor.call(this, anElement, args); 35 Clipperz.PM.Components.RecordDetail.DirectLoginBindingComponent.superclass.constructor.call(this, anElement, args);
36 36
37 this._directLoginBinding = args.directLoginBinding || null; 37 this._directLoginBinding = args.directLoginBinding || null;
38 this.render(); 38 this.render();
39 39
40 Clipperz.NotificationCenter.register(this.record(), 'addNewRecordField',this, 'syncAndUpdateEditMode'); 40 Clipperz.NotificationCenter.register(this.record(), 'addNewRecordField',this, 'syncAndUpdateEditMode');
41 Clipperz.NotificationCenter.register(this.record(), 'removedField', this, 'syncAndUpdateEditMode'); 41 Clipperz.NotificationCenter.register(this.record(), 'removedField', this, 'syncAndUpdateEditMode');
42 Clipperz.NotificationCenter.register(this.record(), 'updatedFieldLabel',this, 'syncAndUpdateEditMode'); 42 Clipperz.NotificationCenter.register(this.record(), 'updatedFieldLabel',this, 'syncAndUpdateEditMode');
43//MochiKit.Logging.logDebug("<<< new DirectLoginBindingComponent"); 43//MochiKit.Logging.logDebug("<<< new DirectLoginBindingComponent");
44 44
45 return this; 45 return this;
46} 46}
47 47
48//============================================================================= 48//=============================================================================
49 49
50YAHOO.extendX(Clipperz.PM.Components.RecordDetail.DirectLoginBindingComponent, Clipperz.PM.Components.RecordDetail.AbstractComponent, { 50YAHOO.extendX(Clipperz.PM.Components.RecordDetail.DirectLoginBindingComponent, Clipperz.PM.Components.RecordDetail.AbstractComponent, {
51 51
52 'toString': function() { 52 'toString': function() {
53 return "Clipperz.PM.Components.RecordDetail.DirectLoginBindingComponent component"; 53 return "Clipperz.PM.Components.RecordDetail.DirectLoginBindingComponent component";
54 }, 54 },
55 55
56 //------------------------------------------------------------------------- 56 //-------------------------------------------------------------------------
57 57
58 'directLoginBinding': function() { 58 'directLoginBinding': function() {
59 return this._directLoginBinding; 59 return this._directLoginBinding;
60 }, 60 },
61 61
62 //------------------------------------------------------------------------- 62 //-------------------------------------------------------------------------
63 63
64 'render': function() { 64 'render': function() {
65 // Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'span', style:'font-weight:bold;', html:this.directLoginBinding().key()}) 65 // Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'span', style:'font-weight:bold;', html:this.directLoginBinding().key()})
66 // Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'span', html:this.directLoginBinding().value()}) 66 // Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'span', html:this.directLoginBinding().value()})
67//MochiKit.Logging.logDebug(">>> DirectLoginBindingComponent.render"); 67//MochiKit.Logging.logDebug(">>> DirectLoginBindingComponent.render");
68 Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'td', cls:'directLoginBindingLabelTD', children:[ 68 Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'td', cls:'directLoginBindingLabelTD', children:[
69 {tag:'span', html:this.directLoginBinding().key()} 69 {tag:'span', html:this.directLoginBinding().key()}
70 ]}); 70 ]});
71//MochiKit.Logging.logDebug("--- DirectLoginBindingComponent.render - 1"); 71//MochiKit.Logging.logDebug("--- DirectLoginBindingComponent.render - 1");
72 Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'td', cls:'directLoginBindingValueTD', children:[ 72 Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'td', cls:'directLoginBindingValueTD', children:[
73 {tag:'div', id:this.getId('editModeBox'), children:[ 73 {tag:'div', id:this.getId('editModeBox'), children:[
74 {tag:'select', id:this.getId('select'), children:this.recordFieldOptions()} 74 {tag:'select', id:this.getId('select'), children:this.recordFieldOptions()}
75 ]}, 75 ]},
76 {tag:'div', id:this.getId('viewModeBox'), children:[ 76 {tag:'div', id:this.getId('viewModeBox'), children:[
77 {tag:'span', id:this.getId('viewValue'), html:""} 77 {tag:'span', id:this.getId('viewValue'), html:""}
78 ]} 78 ]}
79 ]}); 79 ]});
80//MochiKit.Logging.logDebug("--- DirectLoginBindingComponent.render - 2"); 80//MochiKit.Logging.logDebug("--- DirectLoginBindingComponent.render - 2");
81 this.getElement('editModeBox').setVisibilityMode(YAHOO.ext.Element.DISPLAY); 81 this.getElement('editModeBox').setVisibilityMode(YAHOO.ext.Element.DISPLAY);
82 this.getElement('viewModeBox').setVisibilityMode(YAHOO.ext.Element.DISPLAY); 82 this.getElement('viewModeBox').setVisibilityMode(YAHOO.ext.Element.DISPLAY);
83 83
84 this.update(); 84 this.update();
85//MochiKit.Logging.logDebug("<<< DirectLoginBindingComponent.render"); 85//MochiKit.Logging.logDebug("<<< DirectLoginBindingComponent.render");
86 }, 86 },
87 87
88 //------------------------------------------------------------------------- 88 //-------------------------------------------------------------------------
89 89
90 'recordFieldOptions': function() { 90 'recordFieldOptions': function() {
91 varresult; 91 varresult;
92 var option; 92 var option;
93 varrecordFieldKey; 93 varrecordFieldKey;
94 varrecordFields; 94 varrecordFields;
95 95
96//MochiKit.Logging.logDebug(">>> DirectLoginBindingComponent.recordFieldOptions"); 96//MochiKit.Logging.logDebug(">>> DirectLoginBindingComponent.recordFieldOptions");
97 recordFields = this.directLoginBinding().directLogin().record().currentVersion().fields(); 97 recordFields = this.directLoginBinding().directLogin().record().currentVersion().fields();
98 result = []; 98 result = [];
99 option = {tag:'option', value:null, html:'---'}; 99 option = {tag:'option', value:null, html:'---'};
100 result.push(option); 100 result.push(option);
101 for (recordFieldKey in recordFields) { 101 for (recordFieldKey in recordFields) {
102 //TODO: remove the value: field and replace it with element.dom.value = <some value> 102 //TODO: remove the value: field and replace it with element.dom.value = <some value>
103 option = {tag:'option', value:recordFieldKey, html:recordFields[recordFieldKey].label()} 103 option = {tag:'option', value:recordFieldKey, html:Clipperz.Base.sanitizeString(recordFields[recordFieldKey].label())}
104 if (recordFieldKey == this.directLoginBinding().fieldKey()) { 104 if (recordFieldKey == this.directLoginBinding().fieldKey()) {
105 option['selected'] = true; 105 option['selected'] = true;
106 } 106 }
107 result.push(option); 107 result.push(option);
108 } 108 }
109//MochiKit.Logging.logDebug("<<< DirectLoginBindingComponent.recordFieldOptions"); 109//MochiKit.Logging.logDebug("<<< DirectLoginBindingComponent.recordFieldOptions");
110 110
111 return result; 111 return result;
112 }, 112 },
113 113
114 //------------------------------------------------------------------------- 114 //-------------------------------------------------------------------------
115 115
116 'syncAndUpdateEditMode': function() { 116 'syncAndUpdateEditMode': function() {
117 this.synchronizeComponentValues(); 117 this.synchronizeComponentValues();
118 this.updateEditMode(); 118 this.updateEditMode();
119 }, 119 },
120 120
121 'updateEditMode': function() { 121 'updateEditMode': function() {
122 varselectElementBox; 122 varselectElementBox;
123 123
124//MochiKit.Logging.logDebug(">>> DirectLoginBindingComponent.updateEditMode"); 124//MochiKit.Logging.logDebug(">>> DirectLoginBindingComponent.updateEditMode");
125 this.getElement('viewModeBox').hide(); 125 this.getElement('viewModeBox').hide();
126 126
127 selectElementBox = this.getElement('editModeBox'); 127 selectElementBox = this.getElement('editModeBox');
128 selectElementBox.update(""); 128 selectElementBox.update("");
129 129
130 Clipperz.YUI.DomHelper.append(selectElementBox.dom, {tag:'select', id:this.getId('select'), children:this.recordFieldOptions()}); 130 Clipperz.YUI.DomHelper.append(selectElementBox.dom, {tag:'select', id:this.getId('select'), children:this.recordFieldOptions()});
131 131
132/* 132/*
133 selectElement = this.getElement('select'); 133 selectElement = this.getElement('select');
134 134
135 selectElement.update(""); 135 selectElement.update("");
136 MochiKit.Iter.forEach(this.recordFieldOptions(), function(anOption) { 136 MochiKit.Iter.forEach(this.recordFieldOptions(), function(anOption) {
137 Clipperz.YUI.DomHelper.append(selectElement.dom, anOption); 137 Clipperz.YUI.DomHelper.append(selectElement.dom, anOption);
138 }); 138 });
139*/ 139*/
140 140
141 141
142 this.getElement('editModeBox').show(); 142 this.getElement('editModeBox').show();
143//MochiKit.Logging.logDebug("<<< DirectLoginBindingComponent.updateEditMode"); 143//MochiKit.Logging.logDebug("<<< DirectLoginBindingComponent.updateEditMode");
144 }, 144 },
145 145
146 //------------------------------------------------------------------------- 146 //-------------------------------------------------------------------------
147 147
148 'updateViewMode': function() { 148 'updateViewMode': function() {
149//MochiKit.Logging.logDebug(">>> DirectLoginBindingComponent.updateViewMode"); 149//MochiKit.Logging.logDebug(">>> DirectLoginBindingComponent.updateViewMode");
150 this.getElement('editModeBox').hide(); 150 this.getElement('editModeBox').hide();
151 this.getElement('viewModeBox').show(); 151 this.getElement('viewModeBox').show();
152 152
153 this.getElement('viewValue').update(this.directLoginBinding().field().label()); 153 this.getElement('viewValue').update(Clipperz.Base.sanitizeString(this.directLoginBinding().field().label()));
154//MochiKit.Logging.logDebug("<<< DirectLoginBindingComponent.updateViewMode"); 154//MochiKit.Logging.logDebug("<<< DirectLoginBindingComponent.updateViewMode");
155 }, 155 },
156 156
157 //------------------------------------------------------------------------- 157 //-------------------------------------------------------------------------
158 158
159 'synchronizeComponentValues': function() { 159 'synchronizeComponentValues': function() {
160//MochiKit.Logging.logDebug(">>> DirectLoginBindingComponent.synchronizeComponentValues") 160//MochiKit.Logging.logDebug(">>> DirectLoginBindingComponent.synchronizeComponentValues")
161//MochiKit.Logging.logDebug("--- DirectLoginBindingComponent.synchronizeComponentValues - 1 - " + this.getId('select')); 161//MochiKit.Logging.logDebug("--- DirectLoginBindingComponent.synchronizeComponentValues - 1 - " + this.getId('select'));
162 this.directLoginBinding().setFieldKey(this.getDom('select').value); 162 this.directLoginBinding().setFieldKey(this.getDom('select').value);
163//MochiKit.Logging.logDebug("<<< DirectLoginBindingComponent.synchronizeComponentValues"); 163//MochiKit.Logging.logDebug("<<< DirectLoginBindingComponent.synchronizeComponentValues");
164 }, 164 },
165 165
166 //------------------------------------------------------------------------- 166 //-------------------------------------------------------------------------
167 __syntaxFix__: "syntax fix" 167 __syntaxFix__: "syntax fix"
168}); 168});
169 169
diff --git a/frontend/beta/js/Clipperz/PM/DataModel/DirectLogin.js b/frontend/beta/js/Clipperz/PM/DataModel/DirectLogin.js
index c0cfa3c..56d9d59 100644
--- a/frontend/beta/js/Clipperz/PM/DataModel/DirectLogin.js
+++ b/frontend/beta/js/Clipperz/PM/DataModel/DirectLogin.js
@@ -1,531 +1,539 @@
1/* 1/*
2 2
3Copyright 2008-2013 Clipperz Srl 3Copyright 2008-2013 Clipperz Srl
4 4
5This file is part of Clipperz, the online password manager. 5This file is part of Clipperz, the online password manager.
6For further information about its features and functionalities please 6For further information about its features and functionalities please
7refer to http://www.clipperz.com. 7refer to http://www.clipperz.com.
8 8
9* Clipperz is free software: you can redistribute it and/or modify it 9* Clipperz is free software: you can redistribute it and/or modify it
10 under the terms of the GNU Affero General Public License as published 10 under the terms of the GNU Affero General Public License as published
11 by the Free Software Foundation, either version 3 of the License, or 11 by the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version. 12 (at your option) any later version.
13 13
14* Clipperz is distributed in the hope that it will be useful, but 14* Clipperz is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of 15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17 See the GNU Affero General Public License for more details. 17 See the GNU Affero General Public License for more details.
18 18
19* 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
20 License along with Clipperz. If not, see http://www.gnu.org/licenses/. 20 License along with Clipperz. If not, see http://www.gnu.org/licenses/.
21 21
22*/ 22*/
23 23
24if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } 24if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
25if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } 25if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
26if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; } 26if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; }
27 27
28 28
29//############################################################################# 29//#############################################################################
30 30
31Clipperz.PM.DataModel.DirectLogin = function(args) { 31Clipperz.PM.DataModel.DirectLogin = function(args) {
32//MochiKit.Logging.logDebug(">>> new Clipperz.PM.DataModel.DirectLogin"); 32//MochiKit.Logging.logDebug(">>> new Clipperz.PM.DataModel.DirectLogin");
33//console.log(">>> new Clipperz.PM.DataModel.DirectLogin - args: %o", args); 33//console.log(">>> new Clipperz.PM.DataModel.DirectLogin - args: %o", args);
34//console.log("--- formData: %s", Clipperz.Base.serializeJSON(args.formData)); 34//console.log("--- formData: %s", Clipperz.Base.serializeJSON(args.formData));
35 args = args || {}; 35 args = args || {};
36 36
37//MochiKit.Logging.logDebug("--- new Clipperz.PM.DataModel.DirectLogin - args: " + Clipperz.Base.serializeJSON(MochiKit.Base.keys(args))); 37//MochiKit.Logging.logDebug("--- new Clipperz.PM.DataModel.DirectLogin - args: " + Clipperz.Base.serializeJSON(MochiKit.Base.keys(args)));
38 this._record = args.record || null; 38 this._record = args.record || null;
39 this._label = args.label || "unnamed record" 39 this._label = args.label || "unnamed record"
40 this._reference = args.reference || Clipperz.PM.Crypto.randomKey(); 40 this._reference = args.reference || Clipperz.PM.Crypto.randomKey();
41 this._favicon = args.favicon || null; 41 this._favicon = Clipperz.Base.sanitizeFavicon(args.favicon) || null;
42 this._bookmarkletVersion = args.bookmarkletVersion || "0.1"; 42 this._bookmarkletVersion = args.bookmarkletVersion || "0.1";
43 43
44 this._directLoginInputs = null; 44 this._directLoginInputs = null;
45 45
46 this._formValues = args.formValues || {}; 46 this._formValues = args.formValues || {};
47 this.setFormData(args.formData || null); 47 this.setFormData(args.formData || null);
48//console.log("=== formData: %o", this.formData()); 48//console.log("=== formData: %o", this.formData());
49 49
50 if (args.legacyBindingData == null) { 50 if (args.legacyBindingData == null) {
51 this.setBindingData(args.bindingData || null); 51 this.setBindingData(args.bindingData || null);
52 } else { 52 } else {
53 this.setLegacyBindingData(args.legacyBindingData); 53 this.setLegacyBindingData(args.legacyBindingData);
54 } 54 }
55 55
56 this._fixedFavicon = null; 56 this._fixedFavicon = null;
57 57
58 //this._formValues = args.formValues || (this.hasValuesToSet() ? {} : null); 58 //this._formValues = args.formValues || (this.hasValuesToSet() ? {} : null);
59//MochiKit.Logging.logDebug("<<< new Clipperz.PM.DataModel.DirectLogin"); 59//MochiKit.Logging.logDebug("<<< new Clipperz.PM.DataModel.DirectLogin");
60 60
61 return this; 61 return this;
62} 62}
63 63
64Clipperz.PM.DataModel.DirectLogin.prototype = MochiKit.Base.update(null, { 64Clipperz.PM.DataModel.DirectLogin.prototype = MochiKit.Base.update(null, {
65 65
66 'remove': function() { 66 'remove': function() {
67 this.record().removeDirectLogin(this); 67 this.record().removeDirectLogin(this);
68 }, 68 },
69 69
70 //------------------------------------------------------------------------- 70 //-------------------------------------------------------------------------
71 71
72 'record': function() { 72 'record': function() {
73 return this._record; 73 return this._record;
74 }, 74 },
75 75
76 //------------------------------------------------------------------------- 76 //-------------------------------------------------------------------------
77 77
78 'user': function() { 78 'user': function() {
79 return this.record().user(); 79 return this.record().user();
80 }, 80 },
81 81
82 //------------------------------------------------------------------------- 82 //-------------------------------------------------------------------------
83 83
84 'reference': function() { 84 'reference': function() {
85 return this._reference; 85 return this._reference;
86 }, 86 },
87 87
88 //------------------------------------------------------------------------- 88 //-------------------------------------------------------------------------
89 89
90 'label': function() { 90 'label': function() {
91 return this._label; 91 return this._label;
92 }, 92 },
93 93
94 'setLabel': function(aValue) { 94 'setLabel': function(aValue) {
95 this._label = aValue; 95 this._label = aValue;
96 }, 96 },
97 97
98 //------------------------------------------------------------------------- 98 //-------------------------------------------------------------------------
99 99
100 'favicon': function() { 100 'favicon': function() {
101 if (this._favicon == null) { 101 if (this._favicon == null) {
102 varactionUrl; 102 varactionUrl;
103 var hostname; 103 var hostname;
104 104
105 actionUrl = this.formData()['attributes']['action']; 105 actionUrl = this.action();
106 hostname = actionUrl.replace(/^https?:\/\/([^\/]*)\/.*/, '$1'); 106 hostname = actionUrl.replace(/^https?:\/\/([^\/]*)\/.*/, '$1');
107 this._favicon = "http://" + hostname + "/favicon.ico"; 107 this._favicon = Clipperz.Base.sanitizeFavicon("http://" + hostname + "/favicon.ico");
108 } 108 }
109 109
110 return this._favicon; 110 return this._favicon;
111 }, 111 },
112 112
113 //------------------------------------------------------------------------- 113 //-------------------------------------------------------------------------
114 114
115 'fixedFavicon': function() { 115 'fixedFavicon': function() {
116 var result; 116 var result;
117 117
118 if (this._fixedFavicon == null) { 118 if (this._fixedFavicon == null) {
119 result = this.favicon(); 119 result = this.favicon();
120 120
121 if (Clipperz_IEisBroken) { 121 if (Clipperz_IEisBroken) {
122 if (this.user().preferences().disableUnsecureFaviconLoadingForIE()) { 122 if (this.user().preferences().disableUnsecureFaviconLoadingForIE()) {
123 if (result.indexOf('https://') != 0) { 123 if (result.indexOf('https://') != 0) {
124 result = Clipperz.PM.Strings['defaultFaviconUrl_IE']; 124 result = Clipperz.PM.Strings['defaultFaviconUrl_IE'];
125 this.setFixedFavicon(result); 125 this.setFixedFavicon(result);
126 } 126 }
127 } 127 }
128 } 128 }
129 } else { 129 } else {
130 result = this._fixedFavicon; 130 result = this._fixedFavicon;
131 } 131 }
132 132
133 return result; 133 return result;
134 }, 134 },
135 135
136 'setFixedFavicon': function(aValue) { 136 'setFixedFavicon': function(aValue) {
137 this._fixedFavicon = aValue; 137 this._fixedFavicon = aValue;
138 }, 138 },
139 139
140 'action': function () {
141 varresult;
142
143 result = Clipperz.Base.sanitizeUrl(this.formData()['attributes']['action']);
144
145 return result;
146 },
147
140 //------------------------------------------------------------------------- 148 //-------------------------------------------------------------------------
141 149
142 'bookmarkletVersion': function() { 150 'bookmarkletVersion': function() {
143 return this._bookmarkletVersion; 151 return this._bookmarkletVersion;
144 }, 152 },
145 153
146 'setBookmarkletVersion': function(aValue) { 154 'setBookmarkletVersion': function(aValue) {
147 this._bookmarkletVersion = aValue; 155 this._bookmarkletVersion = aValue;
148 }, 156 },
149 157
150 //------------------------------------------------------------------------- 158 //-------------------------------------------------------------------------
151 159
152 'formData': function() { 160 'formData': function() {
153 return this._formData; 161 return this._formData;
154 }, 162 },
155 163
156 'setFormData': function(aValue) { 164 'setFormData': function(aValue) {
157 var formData; 165 var formData;
158 166
159//MochiKit.Logging.logDebug(">>> DirectLogin.setFormData - " + Clipperz.Base.serializeJSON(aValue)); 167//MochiKit.Logging.logDebug(">>> DirectLogin.setFormData - " + Clipperz.Base.serializeJSON(aValue));
160 switch (this.bookmarkletVersion()) { 168 switch (this.bookmarkletVersion()) {
161 case "0.2": 169 case "0.2":
162 formData = aValue; 170 formData = aValue;
163 break; 171 break;
164 case "0.1": 172 case "0.1":
165//MochiKit.Logging.logDebug("--- DirectLogin.setFormData - fixing form data from bookmarklet version 0.1"); 173//MochiKit.Logging.logDebug("--- DirectLogin.setFormData - fixing form data from bookmarklet version 0.1");
166 formData = this.fixFormDataFromBookmarkletVersion_0_1(aValue); 174 formData = this.fixFormDataFromBookmarkletVersion_0_1(aValue);
167 break; 175 break;
168 } 176 }
169 177
170 this._formData = aValue; 178 this._formData = aValue;
171 this.setBookmarkletVersion("0.2"); 179 this.setBookmarkletVersion("0.2");
172 180
173//MochiKit.Logging.logDebug("--- DirectLogin.setFormData - formData: " + Clipperz.Base.serializeJSON(formData)); 181//MochiKit.Logging.logDebug("--- DirectLogin.setFormData - formData: " + Clipperz.Base.serializeJSON(formData));
174 if (formData != null) { 182 if (formData != null) {
175 var i,c; 183 var i,c;
176 184
177 this._directLoginInputs = []; 185 this._directLoginInputs = [];
178 c = formData['inputs'].length; 186 c = formData['inputs'].length;
179 for (i=0; i<c; i++) { 187 for (i=0; i<c; i++) {
180 var directLoginInput; 188 var directLoginInput;
181 189
182 directLoginInput = new Clipperz.PM.DataModel.DirectLoginInput(this, formData['inputs'][i]); 190 directLoginInput = new Clipperz.PM.DataModel.DirectLoginInput(this, formData['inputs'][i]);
183 this._directLoginInputs.push(directLoginInput); 191 this._directLoginInputs.push(directLoginInput);
184 } 192 }
185 } 193 }
186//MochiKit.Logging.logDebug("<<< DirectLogin.setFormData"); 194//MochiKit.Logging.logDebug("<<< DirectLogin.setFormData");
187 }, 195 },
188 196
189 'fixFormDataFromBookmarkletVersion_0_1': function(aValue) { 197 'fixFormDataFromBookmarkletVersion_0_1': function(aValue) {
190//{"type":"radio", "name":"action", "value":"new-user", "checked":false }, { "type":"radio", "name":"action", "value":"sign-in", "checked":true } 198//{"type":"radio", "name":"action", "value":"new-user", "checked":false }, { "type":"radio", "name":"action", "value":"sign-in", "checked":true }
191 // || 199 // ||
192 // \ / 200 // \ /
193 // \/ 201 // \/
194//{"name":"dominio", "type":"radio", "options":[{"value":"@alice.it", "checked":true}, {"value":"@tin.it", "checked":false}, {"value":"@virgilio.it", "checked":false}, {"value":"@tim.it", "checked":false}]} 202//{"name":"dominio", "type":"radio", "options":[{"value":"@alice.it", "checked":true}, {"value":"@tin.it", "checked":false}, {"value":"@virgilio.it", "checked":false}, {"value":"@tim.it", "checked":false}]}
195 var result; 203 var result;
196 var inputs; 204 var inputs;
197 var updatedInputs; 205 var updatedInputs;
198 var radios; 206 var radios;
199 207
200//MochiKit.Logging.logDebug(">>> DirectLogin.fixFormDataFromBookmarkletVersion_0_1"); 208//MochiKit.Logging.logDebug(">>> DirectLogin.fixFormDataFromBookmarkletVersion_0_1");
201 result = aValue; 209 result = aValue;
202 inputs = aValue['inputs']; 210 inputs = aValue['inputs'];
203 211
204 updatedInputs = MochiKit.Base.filter(function(anInput) { 212 updatedInputs = MochiKit.Base.filter(function(anInput) {
205 varresult; 213 varresult;
206 var type; 214 var type;
207 215
208 type = anInput['type'] || 'text'; 216 type = anInput['type'] || 'text';
209 result = type.toLowerCase() != 'radio'; 217 result = type.toLowerCase() != 'radio';
210 218
211 return result; 219 return result;
212 }, inputs); 220 }, inputs);
213 radios = MochiKit.Base.filter(function(anInput) { 221 radios = MochiKit.Base.filter(function(anInput) {
214 varresult; 222 varresult;
215 var type; 223 var type;
216 224
217 type = anInput['type'] || 'text'; 225 type = anInput['type'] || 'text';
218 result = type.toLowerCase() == 'radio'; 226 result = type.toLowerCase() == 'radio';
219 227
220 return result; 228 return result;
221 }, inputs); 229 }, inputs);
222 230
223 if (radios.length > 0) { 231 if (radios.length > 0) {
224 var updatedRadios; 232 var updatedRadios;
225 233
226 updatedRadios = {}; 234 updatedRadios = {};
227 MochiKit.Iter.forEach(radios, MochiKit.Base.bind(function(aRadio) { 235 MochiKit.Iter.forEach(radios, MochiKit.Base.bind(function(aRadio) {
228 varradioConfiguration; 236 varradioConfiguration;
229 237
230 radioConfiguration = updatedRadios[aRadio['name']]; 238 radioConfiguration = updatedRadios[aRadio['name']];
231 if (radioConfiguration == null) { 239 if (radioConfiguration == null) {
232 radioConfiguration = {type:'radio', name:aRadio['name'], options:[]}; 240 radioConfiguration = {type:'radio', name:aRadio['name'], options:[]};
233 updatedRadios[aRadio['name']] = radioConfiguration; 241 updatedRadios[aRadio['name']] = radioConfiguration;
234 } 242 }
235 243
236 //TODO: remove the value: field and replace it with element.dom.value = <some value> 244 //TODO: remove the value: field and replace it with element.dom.value = <some value>
237 radioConfiguration.options.push({value:aRadio['value'], checked:aRadio['checked']}); 245 radioConfiguration.options.push({value:aRadio['value'], checked:aRadio['checked']});
238 246
239 if ((aRadio['checked'] == true) && (this.formValues()[aRadio['name']] == null)) { 247 if ((aRadio['checked'] == true) && (this.formValues()[aRadio['name']] == null)) {
240//MochiKit.Logging.logDebug("+++ setting value '" + aRadio['value'] + "' for key: '" + aRadio['name'] + "'"); 248//MochiKit.Logging.logDebug("+++ setting value '" + aRadio['value'] + "' for key: '" + aRadio['name'] + "'");
241 this.formValues()[aRadio['name']] = aRadio['value']; 249 this.formValues()[aRadio['name']] = aRadio['value'];
242 } 250 }
243 }, this)) 251 }, this))
244 252
245 updatedInputs = MochiKit.Base.concat(updatedInputs, MochiKit.Base.values(updatedRadios)); 253 updatedInputs = MochiKit.Base.concat(updatedInputs, MochiKit.Base.values(updatedRadios));
246 } 254 }
247 255
248 delete result.inputs; 256 delete result.inputs;
249 result.inputs = updatedInputs; 257 result.inputs = updatedInputs;
250//MochiKit.Logging.logDebug("<<< DirectLogin.fixFormDataFromBookmarkletVersion_0_1"); 258//MochiKit.Logging.logDebug("<<< DirectLogin.fixFormDataFromBookmarkletVersion_0_1");
251 259
252 return result; 260 return result;
253 }, 261 },
254 262
255 //......................................................................... 263 //.........................................................................
256 264
257 'directLoginInputs': function() { 265 'directLoginInputs': function() {
258 return this._directLoginInputs; 266 return this._directLoginInputs;
259 }, 267 },
260 268
261 //------------------------------------------------------------------------- 269 //-------------------------------------------------------------------------
262 270
263 'formValues': function() { 271 'formValues': function() {
264 return this._formValues; 272 return this._formValues;
265 }, 273 },
266 274
267 'hasValuesToSet': function() { 275 'hasValuesToSet': function() {
268 var result; 276 var result;
269 277
270//MochiKit.Logging.logDebug(">>> DirectLogin.hasValuesToSet"); 278//MochiKit.Logging.logDebug(">>> DirectLogin.hasValuesToSet");
271 if (this.directLoginInputs() != null) { 279 if (this.directLoginInputs() != null) {
272 result = MochiKit.Iter.some(this.directLoginInputs(), MochiKit.Base.methodcaller('shouldSetValue')); 280 result = MochiKit.Iter.some(this.directLoginInputs(), MochiKit.Base.methodcaller('shouldSetValue'));
273 } else { 281 } else {
274 result = false; 282 result = false;
275 } 283 }
276//MochiKit.Logging.logDebug("<<< DirectLogin.hasValuesToSet"); 284//MochiKit.Logging.logDebug("<<< DirectLogin.hasValuesToSet");
277 285
278 return result; 286 return result;
279 }, 287 },
280 288
281 //'additionalValues': function() { 289 //'additionalValues': function() {
282 'inputsRequiringAdditionalValues': function() { 290 'inputsRequiringAdditionalValues': function() {
283 varresult; 291 varresult;
284 var inputs; 292 var inputs;
285 293
286//MochiKit.Logging.logDebug(">>> DirectLogin.additionalValues"); 294//MochiKit.Logging.logDebug(">>> DirectLogin.additionalValues");
287 result = {}; 295 result = {};
288 if (this.directLoginInputs() != null) { 296 if (this.directLoginInputs() != null) {
289 inputs = MochiKit.Base.filter(MochiKit.Base.methodcaller('shouldSetValue'), this.directLoginInputs()); 297 inputs = MochiKit.Base.filter(MochiKit.Base.methodcaller('shouldSetValue'), this.directLoginInputs());
290 MochiKit.Iter.forEach(inputs, function(anInput) { 298 MochiKit.Iter.forEach(inputs, function(anInput) {
291 result[anInput.name()] = anInput; 299 result[anInput.name()] = anInput;
292 }) 300 })
293 } 301 }
294//MochiKit.Logging.logDebug("<<< DirectLogin.additionalValues"); 302//MochiKit.Logging.logDebug("<<< DirectLogin.additionalValues");
295 303
296 return result; 304 return result;
297 }, 305 },
298 306
299 //------------------------------------------------------------------------- 307 //-------------------------------------------------------------------------
300 308
301 'bindingData': function() { 309 'bindingData': function() {
302 return this._bindingData; 310 return this._bindingData;
303 }, 311 },
304 312
305 'setBindingData': function(aValue) { 313 'setBindingData': function(aValue) {
306//MochiKit.Logging.logDebug(">>> DirectLogin.setBindingData"); 314//MochiKit.Logging.logDebug(">>> DirectLogin.setBindingData");
307 if (aValue != null) { 315 if (aValue != null) {
308 var bindingKey; 316 var bindingKey;
309 317
310 this._bindingData = aValue; 318 this._bindingData = aValue;
311 this._bindings = {}; 319 this._bindings = {};
312 320
313 for (bindingKey in aValue) { 321 for (bindingKey in aValue) {
314 var directLoginBinding; 322 var directLoginBinding;
315 323
316 directLoginBinding = new Clipperz.PM.DataModel.DirectLoginBinding(this, bindingKey, {fieldKey:aValue[bindingKey]}); 324 directLoginBinding = new Clipperz.PM.DataModel.DirectLoginBinding(this, bindingKey, {fieldKey:aValue[bindingKey]});
317 this._bindings[bindingKey] = directLoginBinding; 325 this._bindings[bindingKey] = directLoginBinding;
318 } 326 }
319 } else { 327 } else {
320 var editableFields; 328 var editableFields;
321 var bindings; 329 var bindings;
322 330
323 bindings = {}; 331 bindings = {};
324 332
325 editableFields = MochiKit.Base.filter(function(aField) { 333 editableFields = MochiKit.Base.filter(function(aField) {
326 var result; 334 var result;
327 var type; 335 var type;
328 336
329 type = aField['type'].toLowerCase(); 337 type = aField['type'].toLowerCase();
330 result = ((type != 'hidden') && (type != 'submit') && (type != 'checkbox') && (type != 'radio') && (type != 'select')); 338 result = ((type != 'hidden') && (type != 'submit') && (type != 'checkbox') && (type != 'radio') && (type != 'select'));
331 339
332 return result; 340 return result;
333 }, this.formData().inputs); 341 }, this.formData().inputs);
334 342
335 MochiKit.Iter.forEach(editableFields, function(anEditableField) { 343 MochiKit.Iter.forEach(editableFields, function(anEditableField) {
336 bindings[anEditableField['name']] = new Clipperz.PM.DataModel.DirectLoginBinding(this, anEditableField['name']); 344 bindings[anEditableField['name']] = new Clipperz.PM.DataModel.DirectLoginBinding(this, anEditableField['name']);
337 }, this); 345 }, this);
338 346
339 this._bindings = bindings; 347 this._bindings = bindings;
340 } 348 }
341//MochiKit.Logging.logDebug("<<< DirectLogin.setBindingData"); 349//MochiKit.Logging.logDebug("<<< DirectLogin.setBindingData");
342 }, 350 },
343 351
344 'setLegacyBindingData': function(aValue) { 352 'setLegacyBindingData': function(aValue) {
345//MochiKit.Logging.logDebug(">>> DirectLogin.setLegacyBindingData"); 353//MochiKit.Logging.logDebug(">>> DirectLogin.setLegacyBindingData");
346 var bindingKey; 354 var bindingKey;
347 355
348 this._bindingData = aValue; 356 this._bindingData = aValue;
349 this._bindings = {}; 357 this._bindings = {};
350 358
351 for (bindingKey in aValue) { 359 for (bindingKey in aValue) {
352 var directLoginBinding; 360 var directLoginBinding;
353 361
354 directLoginBinding = new Clipperz.PM.DataModel.DirectLoginBinding(this, bindingKey, {fieldName:aValue[bindingKey]}); 362 directLoginBinding = new Clipperz.PM.DataModel.DirectLoginBinding(this, bindingKey, {fieldName:aValue[bindingKey]});
355 this._bindings[bindingKey] = directLoginBinding; 363 this._bindings[bindingKey] = directLoginBinding;
356 } 364 }
357//MochiKit.Logging.logDebug("<<< DirectLogin.setLegacyBindingData"); 365//MochiKit.Logging.logDebug("<<< DirectLogin.setLegacyBindingData");
358 }, 366 },
359 367
360 //......................................................................... 368 //.........................................................................
361 369
362 'bindings': function() { 370 'bindings': function() {
363 return this._bindings; 371 return this._bindings;
364 }, 372 },
365 373
366 //------------------------------------------------------------------------- 374 //-------------------------------------------------------------------------
367 375
368 'serializedData': function() { 376 'serializedData': function() {
369 var result; 377 var result;
370 varbindingKey; 378 varbindingKey;
371 379
372 result = {}; 380 result = {};
373 // result.reference = this.reference(); 381 // result.reference = this.reference();
374 result.label = this.label(); 382 result.label = this.label();
375 result.favicon = this.favicon() || ""; 383 result.favicon = this.favicon() || "";
376 result.bookmarkletVersion = this.bookmarkletVersion(); 384 result.bookmarkletVersion = this.bookmarkletVersion();
377 result.formData = this.formData(); 385 result.formData = this.formData();
378 if (this.hasValuesToSet) { 386 if (this.hasValuesToSet) {
379 result.formValues = this.formValues(); 387 result.formValues = this.formValues();
380 } 388 }
381 result.bindingData = {}; 389 result.bindingData = {};
382 390
383 for (bindingKey in this.bindings()) { 391 for (bindingKey in this.bindings()) {
384 result.bindingData[bindingKey] = this.bindings()[bindingKey].serializedData(); 392 result.bindingData[bindingKey] = this.bindings()[bindingKey].serializedData();
385 } 393 }
386 394
387 return result; 395 return result;
388 }, 396 },
389 397
390 //------------------------------------------------------------------------- 398 //-------------------------------------------------------------------------
391 399
392 'handleMissingFaviconImage': function(anEvent) { 400 'handleMissingFaviconImage': function(anEvent) {
393 anEvent.stop(); 401 anEvent.stop();
394 MochiKit.Signal.disconnectAll(anEvent.src()); 402 MochiKit.Signal.disconnectAll(anEvent.src());
395 this.setFixedFavicon(Clipperz.PM.Strings['defaultFaviconUrl']); 403 this.setFixedFavicon(Clipperz.PM.Strings['defaultFaviconUrl']);
396 anEvent.src().src = this.fixedFavicon(); 404 anEvent.src().src = this.fixedFavicon();
397 }, 405 },
398 406
399 //========================================================================= 407 //=========================================================================
400 408
401 'runHttpAuthDirectLogin': function(aWindow) { 409 'runHttpAuthDirectLogin': function(aWindow) {
402 MochiKit.DOM.withWindow(aWindow, MochiKit.Base.bind(function() { 410 MochiKit.DOM.withWindow(aWindow, MochiKit.Base.bind(function() {
403 var completeUrl; 411 var completeUrl;
404 var url; 412 var url;
405 413
406 url = this.bindings()['url'].field().value(); 414 url = this.bindings()['url'].field().value();
407 415
408 if (/^https?\:\/\//.test(url) == false) { 416 if (/^https?\:\/\//.test(url) == false) {
409 url = 'http://' + url; 417 url = 'http://' + url;
410 } 418 }
411 419
412 if (Clipperz_IEisBroken === true) { 420 if (Clipperz_IEisBroken === true) {
413 completeUrl = url; 421 completeUrl = url;
414 } else { 422 } else {
415 var username; 423 var username;
416 var password; 424 var password;
417 425
418 username = this.bindings()['username'].field().value(); 426 username = this.bindings()['username'].field().value();
419 password = this.bindings()['password'].field().value(); 427 password = this.bindings()['password'].field().value();
420 428
421 /(^https?\:\/\/)?(.*)/.test(url); 429 /(^https?\:\/\/)?(.*)/.test(url);
422 430
423 completeUrl = RegExp.$1 + username + ':' + password + '@' + RegExp.$2; 431 completeUrl = RegExp.$1 + username + ':' + password + '@' + RegExp.$2;
424 } 432 }
425 433
426 MochiKit.DOM.currentWindow().location.href = completeUrl; 434 MochiKit.DOM.currentWindow().location.href = completeUrl;
427 }, this)); 435 }, this));
428 }, 436 },
429 437
430 //------------------------------------------------------------------------- 438 //-------------------------------------------------------------------------
431 439
432 'runSubmitFormDirectLogin': function(aWindow) { 440 'runSubmitFormDirectLogin': function(aWindow) {
433 MochiKit.DOM.withWindow(aWindow, MochiKit.Base.bind(function() { 441 MochiKit.DOM.withWindow(aWindow, MochiKit.Base.bind(function() {
434 var formElement; 442 var formElement;
435 varformSubmitFunction; 443 varformSubmitFunction;
436 var submitButtons; 444 var submitButtons;
437 445
438//MochiKit.Logging.logDebug("### runDirectLogin - 3"); 446//MochiKit.Logging.logDebug("### runDirectLogin - 3");
439 // MochiKit.DOM.currentDocument().write('<html><head><title>' + this.label() + '</title><META http-equiv="Content-Type" content="text/html; charset=utf-8" /></head><body></body></html>') 447 // MochiKit.DOM.currentDocument().write('<html><head><title>' + this.label() + '</title><META http-equiv="Content-Type" content="text/html; charset=utf-8" /></head><body></body></html>')
440//MochiKit.Logging.logDebug("### runDirectLogin - 3.1"); 448//MochiKit.Logging.logDebug("### runDirectLogin - 3.1");
441 MochiKit.DOM.appendChildNodes(MochiKit.DOM.currentDocument().body, MochiKit.DOM.H3(null, "Loading " + this.label() + " ...")); 449 MochiKit.DOM.appendChildNodes(MochiKit.DOM.currentDocument().body, MochiKit.DOM.H3(null, "Loading " + this.label() + " ..."));
442//MochiKit.Logging.logDebug("### runDirectLogin - 4"); 450//MochiKit.Logging.logDebug("### runDirectLogin - 4");
443//console.log(this.formData()['attributes']); 451//console.log(this.formData()['attributes']);
444 formElement = MochiKit.DOM.FORM(MochiKit.Base.update({id:'directLoginForm'}, {'method':this.formData()['attributes']['method'], 452 formElement = MochiKit.DOM.FORM(MochiKit.Base.update({id:'directLoginForm'}, {'method':this.formData()['attributes']['method'],
445 'action':this.formData()['attributes']['action']})); 453 'action': this.action()}));
446//MochiKit.Logging.logDebug("### runDirectLogin - 5"); 454//MochiKit.Logging.logDebug("### runDirectLogin - 5");
447 formSubmitFunction = MochiKit.Base.method(formElement, 'submit'); 455 formSubmitFunction = MochiKit.Base.method(formElement, 'submit');
448//MochiKit.Logging.logDebug("### runDirectLogin - 6"); 456//MochiKit.Logging.logDebug("### runDirectLogin - 6");
449 457
450 MochiKit.DOM.appendChildNodes(MochiKit.DOM.currentDocument().body, 458 MochiKit.DOM.appendChildNodes(MochiKit.DOM.currentDocument().body,
451 MochiKit.DOM.DIV({style:'display:none; visibility:hidden;'}, formElement) 459 MochiKit.DOM.DIV({style:'display:none; visibility:hidden;'}, formElement)
452 ); 460 );
453//MochiKit.Logging.logDebug("### runDirectLogin - 7"); 461//MochiKit.Logging.logDebug("### runDirectLogin - 7");
454 MochiKit.DOM.appendChildNodes(formElement, MochiKit.Base.map(MochiKit.Base.methodcaller("formConfiguration"), 462 MochiKit.DOM.appendChildNodes(formElement, MochiKit.Base.map(MochiKit.Base.methodcaller("formConfiguration"),
455 this.directLoginInputs())); 463 this.directLoginInputs()));
456//MochiKit.Logging.logDebug("### runDirectLogin - 8"); 464//MochiKit.Logging.logDebug("### runDirectLogin - 8");
457 465
458 submitButtons = MochiKit.Base.filter(function(anInputElement) { 466 submitButtons = MochiKit.Base.filter(function(anInputElement) {
459//MochiKit.Logging.logDebug("### runDirectLogin - 8.1 - " + anInputElement); 467//MochiKit.Logging.logDebug("### runDirectLogin - 8.1 - " + anInputElement);
460//MochiKit.Logging.logDebug("### runDirectLogin - 8.2 - " + anInputElement.tagName); 468//MochiKit.Logging.logDebug("### runDirectLogin - 8.2 - " + anInputElement.tagName);
461//MochiKit.Logging.logDebug("### runDirectLogin - 8.3 - " + anInputElement.getAttribute('type')); 469//MochiKit.Logging.logDebug("### runDirectLogin - 8.3 - " + anInputElement.getAttribute('type'));
462 return ((anInputElement.tagName.toLowerCase() == 'input') && (anInputElement.getAttribute('type').toLowerCase() == 'submit')); 470 return ((anInputElement.tagName.toLowerCase() == 'input') && (anInputElement.getAttribute('type').toLowerCase() == 'submit'));
463 }, formElement.elements) 471 }, formElement.elements)
464//MochiKit.Logging.logDebug("### runDirectLogin - 9"); 472//MochiKit.Logging.logDebug("### runDirectLogin - 9");
465 473
466 if (submitButtons.length == 0) { 474 if (submitButtons.length == 0) {
467//MochiKit.Logging.logDebug("### OLD submit") 475//MochiKit.Logging.logDebug("### OLD submit")
468 if (Clipperz_IEisBroken == true) { 476 if (Clipperz_IEisBroken == true) {
469//MochiKit.Logging.logDebug("### runDirectLogin - 10"); 477//MochiKit.Logging.logDebug("### runDirectLogin - 10");
470 formElement.submit(); 478 formElement.submit();
471 } else { 479 } else {
472//MochiKit.Logging.logDebug("### runDirectLogin - 11"); 480//MochiKit.Logging.logDebug("### runDirectLogin - 11");
473 formSubmitFunction(); 481 formSubmitFunction();
474 } 482 }
475 } else { 483 } else {
476//MochiKit.Logging.logDebug("### NEW submit") 484//MochiKit.Logging.logDebug("### NEW submit")
477 submitButtons[0].click(); 485 submitButtons[0].click();
478 } 486 }
479 487
480 }, this)); 488 }, this));
481 }, 489 },
482 490
483 //------------------------------------------------------------------------- 491 //-------------------------------------------------------------------------
484 492
485 'runDirectLogin': function(aNewWindow) { 493 'runDirectLogin': function(aNewWindow) {
486 varnewWindow; 494 varnewWindow;
487 495
488//console.log("formData.attributes", this.formData()['attributes']); 496//console.log("formData.attributes", this.formData()['attributes']);
489 // if (/^javascript/.test(this.formData()['attributes']['action'])) { 497 // if (/^javascript/.test(this.formData()['attributes']['action'])) {
490 if ((/^(https?|webdav|ftp)\:/.test(this.formData()['attributes']['action']) == false) && 498 if ((/^(https?|webdav|ftp)\:/.test(this.action()) == false) &&
491 (this.formData()['attributes']['type'] != 'http_auth')) 499 (this.formData()['attributes']['type'] != 'http_auth')
492 { 500 ) {
493 var messageBoxConfiguration; 501 var messageBoxConfiguration;
494 502
495 if (typeof(aNewWindow) != 'undefined') { 503 if (typeof(aNewWindow) != 'undefined') {
496 aNewWindow.close(); 504 aNewWindow.close();
497 } 505 }
498 506
499 messageBoxConfiguration = {}; 507 messageBoxConfiguration = {};
500 messageBoxConfiguration.title = Clipperz.PM.Strings['VulnerabilityWarning_Panel_title']; 508 messageBoxConfiguration.title = Clipperz.PM.Strings['VulnerabilityWarning_Panel_title'];
501 messageBoxConfiguration.msg = Clipperz.PM.Strings['VulnerabilityWarning_Panel_message']; 509 messageBoxConfiguration.msg = Clipperz.PM.Strings['VulnerabilityWarning_Panel_message'];
502 messageBoxConfiguration.animEl = YAHOO.ext.Element.get("mainDiv"); 510 messageBoxConfiguration.animEl = YAHOO.ext.Element.get("mainDiv");
503 messageBoxConfiguration.progress = false; 511 messageBoxConfiguration.progress = false;
504 messageBoxConfiguration.closable = false; 512 messageBoxConfiguration.closable = false;
505 messageBoxConfiguration.buttons = {'cancel': Clipperz.PM.Strings['VulnerabilityWarning_Panel_buttonLabel']}; 513 messageBoxConfiguration.buttons = {'cancel': Clipperz.PM.Strings['VulnerabilityWarning_Panel_buttonLabel']};
506 514
507 Clipperz.YUI.MessageBox.show(messageBoxConfiguration); 515 Clipperz.YUI.MessageBox.show(messageBoxConfiguration);
508 516
509 throw Clipperz.Base.exception.VulnerabilityIssue; 517 throw Clipperz.Base.exception.VulnerabilityIssue;
510 } 518 }
511 519
512//MochiKit.Logging.logDebug("### runDirectLogin - 1 : " + Clipperz.Base.serializeJSON(this.serializedData())); 520//MochiKit.Logging.logDebug("### runDirectLogin - 1 : " + Clipperz.Base.serializeJSON(this.serializedData()));
513 if (typeof(aNewWindow) == 'undefined') { 521 if (typeof(aNewWindow) == 'undefined') {
514 newWindow = window.open(Clipperz.PM.Strings['directLoginJumpPageUrl'], ""); 522 newWindow = window.open(Clipperz.PM.Strings['directLoginJumpPageUrl'], "");
515 } else { 523 } else {
516 newWindow = aNewWindow; 524 newWindow = aNewWindow;
517 } 525 }
518//MochiKit.Logging.logDebug("### runDirectLogin - 2"); 526//MochiKit.Logging.logDebug("### runDirectLogin - 2");
519 527
520 if (this.formData()['attributes']['type'] == 'http_auth') { 528 if (this.formData()['attributes']['type'] == 'http_auth') {
521 this.runHttpAuthDirectLogin(newWindow); 529 this.runHttpAuthDirectLogin(newWindow);
522 } else { 530 } else {
523 this.runSubmitFormDirectLogin(newWindow) 531 this.runSubmitFormDirectLogin(newWindow)
524 } 532 }
525 }, 533 },
526 534
527 //------------------------------------------------------------------------- 535 //-------------------------------------------------------------------------
528 __syntaxFix__: "syntax fix" 536 __syntaxFix__: "syntax fix"
529 537
530}); 538});
531 539
diff --git a/frontend/beta/js/Clipperz/PM/DataModel/DirectLoginReference.js b/frontend/beta/js/Clipperz/PM/DataModel/DirectLoginReference.js
index 236d7c9..ba302da 100644
--- a/frontend/beta/js/Clipperz/PM/DataModel/DirectLoginReference.js
+++ b/frontend/beta/js/Clipperz/PM/DataModel/DirectLoginReference.js
@@ -1,187 +1,187 @@
1/* 1/*
2 2
3Copyright 2008-2013 Clipperz Srl 3Copyright 2008-2013 Clipperz Srl
4 4
5This file is part of Clipperz, the online password manager. 5This file is part of Clipperz, the online password manager.
6For further information about its features and functionalities please 6For further information about its features and functionalities please
7refer to http://www.clipperz.com. 7refer to http://www.clipperz.com.
8 8
9* Clipperz is free software: you can redistribute it and/or modify it 9* Clipperz is free software: you can redistribute it and/or modify it
10 under the terms of the GNU Affero General Public License as published 10 under the terms of the GNU Affero General Public License as published
11 by the Free Software Foundation, either version 3 of the License, or 11 by the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version. 12 (at your option) any later version.
13 13
14* Clipperz is distributed in the hope that it will be useful, but 14* Clipperz is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of 15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17 See the GNU Affero General Public License for more details. 17 See the GNU Affero General Public License for more details.
18 18
19* 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
20 License along with Clipperz. If not, see http://www.gnu.org/licenses/. 20 License along with Clipperz. If not, see http://www.gnu.org/licenses/.
21 21
22*/ 22*/
23 23
24if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } 24if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
25if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } 25if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
26if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; } 26if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; }
27 27
28 28
29//############################################################################# 29//#############################################################################
30 30
31Clipperz.PM.DataModel.DirectLoginReference = function(args) { 31Clipperz.PM.DataModel.DirectLoginReference = function(args) {
32 args = args || {}; 32 args = args || {};
33 33
34//MochiKit.Logging.logDebug(">>> new DirectLoginReference: " + Clipperz.Base.serializeJSON(MochiKit.Base.keys(args))); 34//MochiKit.Logging.logDebug(">>> new DirectLoginReference: " + Clipperz.Base.serializeJSON(MochiKit.Base.keys(args)));
35//MochiKit.Logging.logDebug(">>> new DirectLoginReference - record: " + args.record); 35//MochiKit.Logging.logDebug(">>> new DirectLoginReference - record: " + args.record);
36 this._user = args.user; 36 this._user = args.user;
37 37
38 if (args.directLogin != null) { 38 if (args.directLogin != null) {
39 this._reference = args.directLogin.reference(); 39 this._reference = args.directLogin.reference();
40 this._recordReference = args.directLogin.record().reference(); 40 this._recordReference = args.directLogin.record().reference();
41 this._label = args.directLogin.label(); 41 this._label = args.directLogin.label();
42 this._favicon = args.directLogin.favicon() || null; 42 this._favicon = args.directLogin.favicon() || null;
43 43
44 this._directLogin = args.directLogin; 44 this._directLogin = args.directLogin;
45 this._record = args.directLogin.record(); 45 this._record = args.directLogin.record();
46 } else { 46 } else {
47 this._reference = args.reference; 47 this._reference = args.reference;
48 this._recordReference = args.record; 48 this._recordReference = args.record;
49 this._label = args.label; 49 this._label = args.label;
50 this._favicon = args.favicon || null; 50 this._favicon = Clipperz.Base.sanitizeFavicon(args.favicon) || null;
51 51
52 this._directLogin = null; 52 this._directLogin = null;
53 this._record = null; 53 this._record = null;
54 } 54 }
55 55
56 this._fixedFavicon = null; 56 this._fixedFavicon = null;
57 57
58 return this; 58 return this;
59} 59}
60 60
61Clipperz.PM.DataModel.DirectLoginReference.prototype = MochiKit.Base.update(null, { 61Clipperz.PM.DataModel.DirectLoginReference.prototype = MochiKit.Base.update(null, {
62 62
63 'user': function() { 63 'user': function() {
64 return this._user; 64 return this._user;
65 }, 65 },
66 66
67 //------------------------------------------------------------------------- 67 //-------------------------------------------------------------------------
68 68
69 'reference': function() { 69 'reference': function() {
70 return this._reference; 70 return this._reference;
71 }, 71 },
72 72
73 //------------------------------------------------------------------------- 73 //-------------------------------------------------------------------------
74 74
75 'synchronizeValues': function(aDirectLogin) { 75 'synchronizeValues': function(aDirectLogin) {
76 this._label = aDirectLogin.label(); 76 this._label = aDirectLogin.label();
77 this._favicon = aDirectLogin.favicon(); 77 this._favicon = aDirectLogin.favicon();
78 }, 78 },
79 79
80 //------------------------------------------------------------------------- 80 //-------------------------------------------------------------------------
81 81
82 'label': function() { 82 'label': function() {
83 return this._label; 83 return this._label;
84 }, 84 },
85 85
86 //------------------------------------------------------------------------- 86 //-------------------------------------------------------------------------
87 87
88 'recordReference': function() { 88 'recordReference': function() {
89 return this._recordReference; 89 return this._recordReference;
90 }, 90 },
91 91
92 //------------------------------------------------------------------------- 92 //-------------------------------------------------------------------------
93 93
94 'record': function() { 94 'record': function() {
95//MochiKit.Logging.logDebug(">>> DirectLoginReference.record"); 95//MochiKit.Logging.logDebug(">>> DirectLoginReference.record");
96 if (this._record == null) { 96 if (this._record == null) {
97 this._record = this.user().records()[this.recordReference()]; 97 this._record = this.user().records()[this.recordReference()];
98 } 98 }
99 99
100//MochiKit.Logging.logDebug("<<< DirectLoginReference.record"); 100//MochiKit.Logging.logDebug("<<< DirectLoginReference.record");
101 return this._record; 101 return this._record;
102 }, 102 },
103 103
104 //------------------------------------------------------------------------- 104 //-------------------------------------------------------------------------
105 105
106 'favicon': function() { 106 'favicon': function() {
107 return this._favicon; 107 return this._favicon;
108 }, 108 },
109 109
110 //------------------------------------------------------------------------- 110 //-------------------------------------------------------------------------
111 111
112 'fixedFavicon': function() { 112 'fixedFavicon': function() {
113 var result; 113 var result;
114 114
115 if (this._fixedFavicon == null) { 115 if (this._fixedFavicon == null) {
116 result = this.favicon(); 116 result = this.favicon();
117 117
118 if (Clipperz_IEisBroken && (this.user().preferences().disableUnsecureFaviconLoadingForIE()) && (result.indexOf('https://') != 0)) { 118 if (Clipperz_IEisBroken && (this.user().preferences().disableUnsecureFaviconLoadingForIE()) && (result.indexOf('https://') != 0)) {
119 result = Clipperz.PM.Strings['defaultFaviconUrl_IE']; 119 result = Clipperz.PM.Strings['defaultFaviconUrl_IE'];
120 this.setFixedFavicon(result); 120 this.setFixedFavicon(result);
121 } 121 }
122 } else { 122 } else {
123 result = this._fixedFavicon; 123 result = this._fixedFavicon;
124 } 124 }
125 125
126 return result; 126 return result;
127 }, 127 },
128 128
129 'setFixedFavicon': function(aValue) { 129 'setFixedFavicon': function(aValue) {
130 this._fixedFavicon = aValue; 130 this._fixedFavicon = aValue;
131 }, 131 },
132 132
133 //------------------------------------------------------------------------- 133 //-------------------------------------------------------------------------
134 134
135 'setupJumpPageWindow': function(aWindow) { 135 'setupJumpPageWindow': function(aWindow) {
136//MochiKit.Logging.logDebug(">>> DirectLoginReference.setupJumpPageWindow - " + aWindow); 136//MochiKit.Logging.logDebug(">>> DirectLoginReference.setupJumpPageWindow - " + aWindow);
137 try { 137 try {
138 MochiKit.DOM.withWindow(aWindow, MochiKit.Base.bind(function() { 138 MochiKit.DOM.withWindow(aWindow, MochiKit.Base.bind(function() {
139 MochiKit.DOM.appendChildNodes(MochiKit.DOM.currentDocument().body, 139 MochiKit.DOM.appendChildNodes(MochiKit.DOM.currentDocument().body,
140 MochiKit.DOM.H1(null, "Loading " + this.label()) 140 MochiKit.DOM.H1(null, "Loading " + this.label())
141 ); 141 );
142 }, this)); 142 }, this));
143 } catch(e) { 143 } catch(e) {
144 MochiKit.Logging.logDebug("EXCEPTION: " + e); 144 MochiKit.Logging.logDebug("EXCEPTION: " + e);
145 } 145 }
146//MochiKit.Logging.logDebug("<<< DirectLoginReference.setupJumpPageWindow"); 146//MochiKit.Logging.logDebug("<<< DirectLoginReference.setupJumpPageWindow");
147 }, 147 },
148 148
149 //------------------------------------------------------------------------- 149 //-------------------------------------------------------------------------
150 150
151 'deferredDirectLogin': function() { 151 'deferredDirectLogin': function() {
152 var deferredResult; 152 var deferredResult;
153 153
154//MochiKit.Logging.logDebug(">>> DirectLoginReference.deferredDirectLogin - " + this); 154//MochiKit.Logging.logDebug(">>> DirectLoginReference.deferredDirectLogin - " + this);
155 deferredResult = new MochiKit.Async.Deferred(); 155 deferredResult = new MochiKit.Async.Deferred();
156//MochiKit.Logging.logDebug("--- DirectLoginReference.deferredDirectLogin - 1"); 156//MochiKit.Logging.logDebug("--- DirectLoginReference.deferredDirectLogin - 1");
157 deferredResult.addCallback(MochiKit.Base.method(this.record(), 'deferredData')); 157 deferredResult.addCallback(MochiKit.Base.method(this.record(), 'deferredData'));
158//MochiKit.Logging.logDebug("--- DirectLoginReference.deferredDirectLogin - 2"); 158//MochiKit.Logging.logDebug("--- DirectLoginReference.deferredDirectLogin - 2");
159 deferredResult.addCallback(function(aRecord, aDirectLoginReference) { 159 deferredResult.addCallback(function(aRecord, aDirectLoginReference) {
160 return aRecord.directLogins()[aDirectLoginReference]; 160 return aRecord.directLogins()[aDirectLoginReference];
161 }, this.record(), this.reference()); 161 }, this.record(), this.reference());
162//MochiKit.Logging.logDebug("--- DirectLoginReference.deferredDirectLogin - 3"); 162//MochiKit.Logging.logDebug("--- DirectLoginReference.deferredDirectLogin - 3");
163 deferredResult.callback(); 163 deferredResult.callback();
164//MochiKit.Logging.logDebug("<<< DirectLoginReference.deferredDirectLogin"); 164//MochiKit.Logging.logDebug("<<< DirectLoginReference.deferredDirectLogin");
165 165
166 return deferredResult; 166 return deferredResult;
167 }, 167 },
168 168
169 //------------------------------------------------------------------------- 169 //-------------------------------------------------------------------------
170 170
171 'handleMissingFaviconImage': function(anEvent) { 171 'handleMissingFaviconImage': function(anEvent) {
172//MochiKit.Logging.logDebug(">>> DirectLoginReference.handleMissingFaviconImage"); 172//MochiKit.Logging.logDebug(">>> DirectLoginReference.handleMissingFaviconImage");
173 anEvent.stop(); 173 anEvent.stop();
174 MochiKit.Signal.disconnectAll(anEvent.src()); 174 MochiKit.Signal.disconnectAll(anEvent.src());
175 this.setFixedFavicon(Clipperz.PM.Strings['defaultFaviconUrl']); 175 this.setFixedFavicon(Clipperz.PM.Strings['defaultFaviconUrl']);
176//MochiKit.Logging.logDebug("--- DirectLoginReference.handleMissingFaviconImage - fixedFavicon: " + this.fixedFavicon()); 176//MochiKit.Logging.logDebug("--- DirectLoginReference.handleMissingFaviconImage - fixedFavicon: " + this.fixedFavicon());
177//MochiKit.Logging.logDebug("--- DirectLoginReference.handleMissingFaviconImage - anEvent.src().src: " + anEvent.src().src); 177//MochiKit.Logging.logDebug("--- DirectLoginReference.handleMissingFaviconImage - anEvent.src().src: " + anEvent.src().src);
178 // MochiKit.DOM.swapDOM(anEvent.src(), MochiKit.DOM.IMG({src:'this.fixedFavicon()'})); 178 // MochiKit.DOM.swapDOM(anEvent.src(), MochiKit.DOM.IMG({src:'this.fixedFavicon()'}));
179 anEvent.src().src = this.fixedFavicon(); 179 anEvent.src().src = this.fixedFavicon();
180//MochiKit.Logging.logDebug("<<< DirectLoginReference.handleMissingFaviconImage"); 180//MochiKit.Logging.logDebug("<<< DirectLoginReference.handleMissingFaviconImage");
181 }, 181 },
182 182
183 //------------------------------------------------------------------------- 183 //-------------------------------------------------------------------------
184 __syntaxFix__: "syntax fix" 184 __syntaxFix__: "syntax fix"
185 185
186}); 186});
187 187