summaryrefslogtreecommitdiff
path: root/frontend/beta/js/Clipperz/PM/DataModel
Unidiff
Diffstat (limited to 'frontend/beta/js/Clipperz/PM/DataModel') (more/less context) (ignore whitespace changes)
-rw-r--r--frontend/beta/js/Clipperz/PM/DataModel/DirectLogin.js15
-rw-r--r--frontend/beta/js/Clipperz/PM/DataModel/DirectLoginBinding.js15
-rw-r--r--frontend/beta/js/Clipperz/PM/DataModel/DirectLoginInput.js15
-rw-r--r--frontend/beta/js/Clipperz/PM/DataModel/DirectLoginReference.js15
-rw-r--r--frontend/beta/js/Clipperz/PM/DataModel/Header.js15
-rw-r--r--frontend/beta/js/Clipperz/PM/DataModel/OneTimePassword.js15
-rw-r--r--frontend/beta/js/Clipperz/PM/DataModel/OneTimePasswordManager.js15
-rw-r--r--frontend/beta/js/Clipperz/PM/DataModel/Record.js15
-rw-r--r--frontend/beta/js/Clipperz/PM/DataModel/RecordField.js15
-rw-r--r--frontend/beta/js/Clipperz/PM/DataModel/RecordVersion.js15
-rw-r--r--frontend/beta/js/Clipperz/PM/DataModel/Statistics.js15
-rw-r--r--frontend/beta/js/Clipperz/PM/DataModel/User.js15
-rw-r--r--frontend/beta/js/Clipperz/PM/DataModel/UserPreferences.js15
13 files changed, 78 insertions, 117 deletions
diff --git a/frontend/beta/js/Clipperz/PM/DataModel/DirectLogin.js b/frontend/beta/js/Clipperz/PM/DataModel/DirectLogin.js
index 3ebc208..aee5703 100644
--- a/frontend/beta/js/Clipperz/PM/DataModel/DirectLogin.js
+++ b/frontend/beta/js/Clipperz/PM/DataModel/DirectLogin.js
@@ -1,120 +1,117 @@
1/* 1/*
2 2
3Copyright 2008-2011 Clipperz Srl 3Copyright 2008-2011 Clipperz Srl
4 4
5This file is part of Clipperz's Javascript Crypto Library. 5This file is part of Clipperz Community Edition.
6Javascript Crypto Library provides web developers with an extensive 6Clipperz Community Edition is an online password manager.
7and efficient set of cryptographic functions. The library aims to
8obtain maximum execution speed while preserving modularity and
9reusability.
10For further information about its features and functionalities please 7For further information about its features and functionalities please
11refer to http://www.clipperz.com 8refer to http://www.clipperz.com.
12 9
13* Javascript Crypto Library is free software: you can redistribute 10* Clipperz Community Edition is free software: you can redistribute
14 it and/or modify it under the terms of the GNU Affero General Public 11 it and/or modify it under the terms of the GNU Affero General Public
15 License as published by the Free Software Foundation, either version 12 License as published by the Free Software Foundation, either version
16 3 of the License, or (at your option) any later version. 13 3 of the License, or (at your option) any later version.
17 14
18* Javascript Crypto Library is distributed in the hope that it will 15* Clipperz Community Edition is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied 16 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 17 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details. 18 See the GNU Affero General Public License for more details.
22 19
23* You should have received a copy of the GNU Affero General Public 20* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see 21 License along with Clipperz Community Edition. If not, see
25 <http://www.gnu.org/licenses/>. 22 <http://www.gnu.org/licenses/>.
26 23
27*/ 24*/
28 25
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } 26if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } 27if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; } 28if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; }
32 29
33 30
34//############################################################################# 31//#############################################################################
35 32
36Clipperz.PM.DataModel.DirectLogin = function(args) { 33Clipperz.PM.DataModel.DirectLogin = function(args) {
37//MochiKit.Logging.logDebug(">>> new Clipperz.PM.DataModel.DirectLogin"); 34//MochiKit.Logging.logDebug(">>> new Clipperz.PM.DataModel.DirectLogin");
38//console.log(">>> new Clipperz.PM.DataModel.DirectLogin - args: %o", args); 35//console.log(">>> new Clipperz.PM.DataModel.DirectLogin - args: %o", args);
39//console.log("--- formData: %s", Clipperz.Base.serializeJSON(args.formData)); 36//console.log("--- formData: %s", Clipperz.Base.serializeJSON(args.formData));
40 args = args || {}; 37 args = args || {};
41 38
42//MochiKit.Logging.logDebug("--- new Clipperz.PM.DataModel.DirectLogin - args: " + Clipperz.Base.serializeJSON(MochiKit.Base.keys(args))); 39//MochiKit.Logging.logDebug("--- new Clipperz.PM.DataModel.DirectLogin - args: " + Clipperz.Base.serializeJSON(MochiKit.Base.keys(args)));
43 this._record = args.record || null; 40 this._record = args.record || null;
44 this._label = args.label || "unnamed record" 41 this._label = args.label || "unnamed record"
45 this._reference = args.reference || Clipperz.PM.Crypto.randomKey(); 42 this._reference = args.reference || Clipperz.PM.Crypto.randomKey();
46 this._favicon = args.favicon || null; 43 this._favicon = args.favicon || null;
47 this._bookmarkletVersion = args.bookmarkletVersion || "0.1"; 44 this._bookmarkletVersion = args.bookmarkletVersion || "0.1";
48 45
49 this._directLoginInputs = null; 46 this._directLoginInputs = null;
50 47
51 this._formValues = args.formValues || {}; 48 this._formValues = args.formValues || {};
52 this.setFormData(args.formData || null); 49 this.setFormData(args.formData || null);
53//console.log("=== formData: %o", this.formData()); 50//console.log("=== formData: %o", this.formData());
54 51
55 if (args.legacyBindingData == null) { 52 if (args.legacyBindingData == null) {
56 this.setBindingData(args.bindingData || null); 53 this.setBindingData(args.bindingData || null);
57 } else { 54 } else {
58 this.setLegacyBindingData(args.legacyBindingData); 55 this.setLegacyBindingData(args.legacyBindingData);
59 } 56 }
60 57
61 this._fixedFavicon = null; 58 this._fixedFavicon = null;
62 59
63 //this._formValues = args.formValues || (this.hasValuesToSet() ? {} : null); 60 //this._formValues = args.formValues || (this.hasValuesToSet() ? {} : null);
64//MochiKit.Logging.logDebug("<<< new Clipperz.PM.DataModel.DirectLogin"); 61//MochiKit.Logging.logDebug("<<< new Clipperz.PM.DataModel.DirectLogin");
65 62
66 return this; 63 return this;
67} 64}
68 65
69Clipperz.PM.DataModel.DirectLogin.prototype = MochiKit.Base.update(null, { 66Clipperz.PM.DataModel.DirectLogin.prototype = MochiKit.Base.update(null, {
70 67
71 'remove': function() { 68 'remove': function() {
72 this.record().removeDirectLogin(this); 69 this.record().removeDirectLogin(this);
73 }, 70 },
74 71
75 //------------------------------------------------------------------------- 72 //-------------------------------------------------------------------------
76 73
77 'record': function() { 74 'record': function() {
78 return this._record; 75 return this._record;
79 }, 76 },
80 77
81 //------------------------------------------------------------------------- 78 //-------------------------------------------------------------------------
82 79
83 'user': function() { 80 'user': function() {
84 return this.record().user(); 81 return this.record().user();
85 }, 82 },
86 83
87 //------------------------------------------------------------------------- 84 //-------------------------------------------------------------------------
88 85
89 'reference': function() { 86 'reference': function() {
90 return this._reference; 87 return this._reference;
91 }, 88 },
92 89
93 //------------------------------------------------------------------------- 90 //-------------------------------------------------------------------------
94 91
95 'label': function() { 92 'label': function() {
96 return this._label; 93 return this._label;
97 }, 94 },
98 95
99 'setLabel': function(aValue) { 96 'setLabel': function(aValue) {
100 this._label = aValue; 97 this._label = aValue;
101 }, 98 },
102 99
103 //------------------------------------------------------------------------- 100 //-------------------------------------------------------------------------
104 101
105 'favicon': function() { 102 'favicon': function() {
106 if (this._favicon == null) { 103 if (this._favicon == null) {
107 varactionUrl; 104 varactionUrl;
108 var hostname; 105 var hostname;
109 106
110 actionUrl = this.formData()['attributes']['action']; 107 actionUrl = this.formData()['attributes']['action'];
111 hostname = actionUrl.replace(/^https?:\/\/([^\/]*)\/.*/, '$1'); 108 hostname = actionUrl.replace(/^https?:\/\/([^\/]*)\/.*/, '$1');
112 this._favicon = "http://" + hostname + "/favicon.ico"; 109 this._favicon = "http://" + hostname + "/favicon.ico";
113 } 110 }
114 111
115 return this._favicon; 112 return this._favicon;
116 }, 113 },
117 114
118 //------------------------------------------------------------------------- 115 //-------------------------------------------------------------------------
119 116
120 'fixedFavicon': function() { 117 'fixedFavicon': function() {
diff --git a/frontend/beta/js/Clipperz/PM/DataModel/DirectLoginBinding.js b/frontend/beta/js/Clipperz/PM/DataModel/DirectLoginBinding.js
index 19aa9cb..7f09bff 100644
--- a/frontend/beta/js/Clipperz/PM/DataModel/DirectLoginBinding.js
+++ b/frontend/beta/js/Clipperz/PM/DataModel/DirectLoginBinding.js
@@ -1,113 +1,110 @@
1/* 1/*
2 2
3Copyright 2008-2011 Clipperz Srl 3Copyright 2008-2011 Clipperz Srl
4 4
5This file is part of Clipperz's Javascript Crypto Library. 5This file is part of Clipperz Community Edition.
6Javascript Crypto Library provides web developers with an extensive 6Clipperz Community Edition is an online password manager.
7and efficient set of cryptographic functions. The library aims to
8obtain maximum execution speed while preserving modularity and
9reusability.
10For further information about its features and functionalities please 7For further information about its features and functionalities please
11refer to http://www.clipperz.com 8refer to http://www.clipperz.com.
12 9
13* Javascript Crypto Library is free software: you can redistribute 10* Clipperz Community Edition is free software: you can redistribute
14 it and/or modify it under the terms of the GNU Affero General Public 11 it and/or modify it under the terms of the GNU Affero General Public
15 License as published by the Free Software Foundation, either version 12 License as published by the Free Software Foundation, either version
16 3 of the License, or (at your option) any later version. 13 3 of the License, or (at your option) any later version.
17 14
18* Javascript Crypto Library is distributed in the hope that it will 15* Clipperz Community Edition is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied 16 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 17 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details. 18 See the GNU Affero General Public License for more details.
22 19
23* You should have received a copy of the GNU Affero General Public 20* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see 21 License along with Clipperz Community Edition. If not, see
25 <http://www.gnu.org/licenses/>. 22 <http://www.gnu.org/licenses/>.
26 23
27*/ 24*/
28 25
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } 26if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } 27if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; } 28if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; }
32 29
33 30
34//############################################################################# 31//#############################################################################
35 32
36Clipperz.PM.DataModel.DirectLoginBinding = function(aDirectLogin, aKey, args) { 33Clipperz.PM.DataModel.DirectLoginBinding = function(aDirectLogin, aKey, args) {
37//MochiKit.Logging.logDebug(">>> new DirectLoginBinding") 34//MochiKit.Logging.logDebug(">>> new DirectLoginBinding")
38 args = args || {}; 35 args = args || {};
39//MochiKit.Logging.logDebug("--- new DirectLoginBinding - args: " + Clipperz.Base.serializeJSON(args)); 36//MochiKit.Logging.logDebug("--- new DirectLoginBinding - args: " + Clipperz.Base.serializeJSON(args));
40 37
41 this._directLogin = aDirectLogin || args.directLogin || null; 38 this._directLogin = aDirectLogin || args.directLogin || null;
42 this._key = aKey; 39 this._key = aKey;
43 40
44 this._fieldKey = args.fieldKey || null; 41 this._fieldKey = args.fieldKey || null;
45 this._fieldName = args.fieldName || null; 42 this._fieldName = args.fieldName || null;
46//MochiKit.Logging.logDebug("<<< new DirectLoginBinding") 43//MochiKit.Logging.logDebug("<<< new DirectLoginBinding")
47 44
48 return this; 45 return this;
49} 46}
50 47
51Clipperz.PM.DataModel.DirectLoginBinding.prototype = MochiKit.Base.update(null, { 48Clipperz.PM.DataModel.DirectLoginBinding.prototype = MochiKit.Base.update(null, {
52 49
53 'directLogin': function() { 50 'directLogin': function() {
54 return this._directLogin; 51 return this._directLogin;
55 }, 52 },
56 53
57 //------------------------------------------------------------------------- 54 //-------------------------------------------------------------------------
58 55
59 'key': function() { 56 'key': function() {
60 return this._key; 57 return this._key;
61 }, 58 },
62 59
63 //------------------------------------------------------------------------- 60 //-------------------------------------------------------------------------
64 61
65 'fieldKey': function() { 62 'fieldKey': function() {
66//MochiKit.Logging.logDebug("=== Clipperz.PM.DataModel.DirectLoginBinding.fieldKey"); 63//MochiKit.Logging.logDebug("=== Clipperz.PM.DataModel.DirectLoginBinding.fieldKey");
67//MochiKit.Logging.logDebug("=== Clipperz.PM.DataModel.DirectLoginBinding.fieldKey - " + this._fieldKey); 64//MochiKit.Logging.logDebug("=== Clipperz.PM.DataModel.DirectLoginBinding.fieldKey - " + this._fieldKey);
68 return this._fieldKey; 65 return this._fieldKey;
69 }, 66 },
70 67
71 'setFieldKey': function(aValue) { 68 'setFieldKey': function(aValue) {
72 this._fieldKey = aValue; 69 this._fieldKey = aValue;
73 }, 70 },
74 71
75 'fieldName': function() { 72 'fieldName': function() {
76 return this._fieldName; 73 return this._fieldName;
77 }, 74 },
78 75
79 //------------------------------------------------------------------------- 76 //-------------------------------------------------------------------------
80 77
81 'field': function() { 78 'field': function() {
82 var result; 79 var result;
83 80
84 //MochiKit.Logging.logDebug(">>> Clipperz.PM.DataModel.DirectLoginBinding.field") 81 //MochiKit.Logging.logDebug(">>> Clipperz.PM.DataModel.DirectLoginBinding.field")
85//MochiKit.Logging.logDebug("--- Clipperz.PM.DataModel.DirectLoginBinding.field - 1 - this.fieldKey(): " + this.fieldKey()); 82//MochiKit.Logging.logDebug("--- Clipperz.PM.DataModel.DirectLoginBinding.field - 1 - this.fieldKey(): " + this.fieldKey());
86//MochiKit.Logging.logDebug("--- Clipperz.PM.DataModel.DirectLoginBinding.field - 2 - this.fieldName(): " + this.fieldName()); 83//MochiKit.Logging.logDebug("--- Clipperz.PM.DataModel.DirectLoginBinding.field - 2 - this.fieldName(): " + this.fieldName());
87 if (this.fieldKey() != null) { 84 if (this.fieldKey() != null) {
88 result = this.directLogin().record().currentVersion().fields()[this.fieldKey()]; 85 result = this.directLogin().record().currentVersion().fields()[this.fieldKey()];
89//MochiKit.Logging.logDebug("--- Clipperz.PM.DataModel.DirectLoginBinding.field - 3 - result: " + result); 86//MochiKit.Logging.logDebug("--- Clipperz.PM.DataModel.DirectLoginBinding.field - 3 - result: " + result);
90 } else if (this.fieldName() != null) { 87 } else if (this.fieldName() != null) {
91 result = this.directLogin().record().currentVersion().fieldWithName(this.fieldName()); 88 result = this.directLogin().record().currentVersion().fieldWithName(this.fieldName());
92//MochiKit.Logging.logDebug("--- Clipperz.PM.DataModel.DirectLoginBinding.field - 4 - result: " + result); 89//MochiKit.Logging.logDebug("--- Clipperz.PM.DataModel.DirectLoginBinding.field - 4 - result: " + result);
93 90
94 this.setFieldKey(result.key()); 91 this.setFieldKey(result.key());
95 } else { 92 } else {
96 result = null; 93 result = null;
97 } 94 }
98 //MochiKit.Logging.logDebug("<<< Clipperz.PM.DataModel.DirectLoginBinding.field") 95 //MochiKit.Logging.logDebug("<<< Clipperz.PM.DataModel.DirectLoginBinding.field")
99 96
100 return result; 97 return result;
101 }, 98 },
102 99
103 //------------------------------------------------------------------------- 100 //-------------------------------------------------------------------------
104 101
105 'serializedData': function() { 102 'serializedData': function() {
106 return this.fieldKey(); 103 return this.fieldKey();
107 }, 104 },
108 105
109 //------------------------------------------------------------------------- 106 //-------------------------------------------------------------------------
110 __syntaxFix__: "syntax fix" 107 __syntaxFix__: "syntax fix"
111 108
112}); 109});
113 110
diff --git a/frontend/beta/js/Clipperz/PM/DataModel/DirectLoginInput.js b/frontend/beta/js/Clipperz/PM/DataModel/DirectLoginInput.js
index 3302ed6..0e2b7ad 100644
--- a/frontend/beta/js/Clipperz/PM/DataModel/DirectLoginInput.js
+++ b/frontend/beta/js/Clipperz/PM/DataModel/DirectLoginInput.js
@@ -1,120 +1,117 @@
1/* 1/*
2 2
3Copyright 2008-2011 Clipperz Srl 3Copyright 2008-2011 Clipperz Srl
4 4
5This file is part of Clipperz's Javascript Crypto Library. 5This file is part of Clipperz Community Edition.
6Javascript Crypto Library provides web developers with an extensive 6Clipperz Community Edition is an online password manager.
7and efficient set of cryptographic functions. The library aims to
8obtain maximum execution speed while preserving modularity and
9reusability.
10For further information about its features and functionalities please 7For further information about its features and functionalities please
11refer to http://www.clipperz.com 8refer to http://www.clipperz.com.
12 9
13* Javascript Crypto Library is free software: you can redistribute 10* Clipperz Community Edition is free software: you can redistribute
14 it and/or modify it under the terms of the GNU Affero General Public 11 it and/or modify it under the terms of the GNU Affero General Public
15 License as published by the Free Software Foundation, either version 12 License as published by the Free Software Foundation, either version
16 3 of the License, or (at your option) any later version. 13 3 of the License, or (at your option) any later version.
17 14
18* Javascript Crypto Library is distributed in the hope that it will 15* Clipperz Community Edition is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied 16 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 17 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details. 18 See the GNU Affero General Public License for more details.
22 19
23* You should have received a copy of the GNU Affero General Public 20* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see 21 License along with Clipperz Community Edition. If not, see
25 <http://www.gnu.org/licenses/>. 22 <http://www.gnu.org/licenses/>.
26 23
27*/ 24*/
28 25
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } 26if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } 27if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; } 28if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; }
32 29
33//############################################################################# 30//#############################################################################
34 31
35Clipperz.PM.DataModel.DirectLoginInput = function(aDirectLogin, args) { 32Clipperz.PM.DataModel.DirectLoginInput = function(aDirectLogin, args) {
36 args = args || {}; 33 args = args || {};
37 34
38//console.log(">>> new DirectLoginInput - args: %o" + args); 35//console.log(">>> new DirectLoginInput - args: %o" + args);
39 this._directLogin = aDirectLogin; 36 this._directLogin = aDirectLogin;
40 this._args = args; 37 this._args = args;
41 38
42 return this; 39 return this;
43} 40}
44 41
45Clipperz.PM.DataModel.DirectLoginInput.prototype = MochiKit.Base.update(null, { 42Clipperz.PM.DataModel.DirectLoginInput.prototype = MochiKit.Base.update(null, {
46 43
47 'directLogin': function() { 44 'directLogin': function() {
48 return this._directLogin; 45 return this._directLogin;
49 }, 46 },
50 47
51 //------------------------------------------------------------------------- 48 //-------------------------------------------------------------------------
52 49
53 'args': function() { 50 'args': function() {
54 return this._args; 51 return this._args;
55 }, 52 },
56 53
57 //------------------------------------------------------------------------- 54 //-------------------------------------------------------------------------
58 55
59 'name': function() { 56 'name': function() {
60 return this.args()['name']; 57 return this.args()['name'];
61 }, 58 },
62 59
63 //------------------------------------------------------------------------- 60 //-------------------------------------------------------------------------
64 61
65 'type': function() { 62 'type': function() {
66 var result; 63 var result;
67 64
68 result = this.args()['type']; 65 result = this.args()['type'];
69 66
70 if (result != null) { 67 if (result != null) {
71 result = result.toLowerCase(); 68 result = result.toLowerCase();
72 } 69 }
73 return result; 70 return result;
74 }, 71 },
75 72
76 //------------------------------------------------------------------------- 73 //-------------------------------------------------------------------------
77 74
78 'value': function() { 75 'value': function() {
79 return this.args()['value']; 76 return this.args()['value'];
80 }, 77 },
81 78
82 //------------------------------------------------------------------------- 79 //-------------------------------------------------------------------------
83 80
84 'formConfiguration': function() { 81 'formConfiguration': function() {
85 var result; 82 var result;
86 83
87//MochiKit.Logging.logDebug(">>> DirectLoginInput.formConfiguration - " + this.name()); 84//MochiKit.Logging.logDebug(">>> DirectLoginInput.formConfiguration - " + this.name());
88 if (this.shouldSetValue()) { 85 if (this.shouldSetValue()) {
89//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 1"); 86//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 1");
90 switch (this.type()) { 87 switch (this.type()) {
91 case 'select': 88 case 'select':
92 var currentValue; 89 var currentValue;
93 var options; 90 var options;
94 91
95//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 2"); 92//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 2");
96 currentValue = this.directLogin().formValues()[this.name()]; 93 currentValue = this.directLogin().formValues()[this.name()];
97//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 2.1"); 94//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 2.1");
98 options = this.args()['options']; 95 options = this.args()['options'];
99//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 2.2"); 96//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 2.2");
100 97
101 result = MochiKit.DOM.SELECT({name:this.name()}, 98 result = MochiKit.DOM.SELECT({name:this.name()},
102 MochiKit.Base.map(function(anOption) { 99 MochiKit.Base.map(function(anOption) {
103 var options; 100 var options;
104 101
105//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 2.3"); 102//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 2.3");
106 //TODO: remove the value: field and replace it with element.dom.value = <some value> 103 //TODO: remove the value: field and replace it with element.dom.value = <some value>
107 options = {value:anOption['value']}; 104 options = {value:anOption['value']};
108//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 2.4"); 105//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 2.4");
109 if (currentValue == anOption['value']) { 106 if (currentValue == anOption['value']) {
110//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 2.5"); 107//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 2.5");
111 options.selected = true; 108 options.selected = true;
112//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 2.6"); 109//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 2.6");
113 } 110 }
114//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 2.7"); 111//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 2.7");
115 112
116 return MochiKit.DOM.OPTION(options, anOption['label']) 113 return MochiKit.DOM.OPTION(options, anOption['label'])
117 }, options) 114 }, options)
118 ) 115 )
119//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 2.8"); 116//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 2.8");
120 break; 117 break;
diff --git a/frontend/beta/js/Clipperz/PM/DataModel/DirectLoginReference.js b/frontend/beta/js/Clipperz/PM/DataModel/DirectLoginReference.js
index b067a21..2be7d58 100644
--- a/frontend/beta/js/Clipperz/PM/DataModel/DirectLoginReference.js
+++ b/frontend/beta/js/Clipperz/PM/DataModel/DirectLoginReference.js
@@ -1,120 +1,117 @@
1/* 1/*
2 2
3Copyright 2008-2011 Clipperz Srl 3Copyright 2008-2011 Clipperz Srl
4 4
5This file is part of Clipperz's Javascript Crypto Library. 5This file is part of Clipperz Community Edition.
6Javascript Crypto Library provides web developers with an extensive 6Clipperz Community Edition is an online password manager.
7and efficient set of cryptographic functions. The library aims to
8obtain maximum execution speed while preserving modularity and
9reusability.
10For further information about its features and functionalities please 7For further information about its features and functionalities please
11refer to http://www.clipperz.com 8refer to http://www.clipperz.com.
12 9
13* Javascript Crypto Library is free software: you can redistribute 10* Clipperz Community Edition is free software: you can redistribute
14 it and/or modify it under the terms of the GNU Affero General Public 11 it and/or modify it under the terms of the GNU Affero General Public
15 License as published by the Free Software Foundation, either version 12 License as published by the Free Software Foundation, either version
16 3 of the License, or (at your option) any later version. 13 3 of the License, or (at your option) any later version.
17 14
18* Javascript Crypto Library is distributed in the hope that it will 15* Clipperz Community Edition is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied 16 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 17 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details. 18 See the GNU Affero General Public License for more details.
22 19
23* You should have received a copy of the GNU Affero General Public 20* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see 21 License along with Clipperz Community Edition. If not, see
25 <http://www.gnu.org/licenses/>. 22 <http://www.gnu.org/licenses/>.
26 23
27*/ 24*/
28 25
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } 26if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } 27if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; } 28if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; }
32 29
33 30
34//############################################################################# 31//#############################################################################
35 32
36Clipperz.PM.DataModel.DirectLoginReference = function(args) { 33Clipperz.PM.DataModel.DirectLoginReference = function(args) {
37 args = args || {}; 34 args = args || {};
38 35
39//MochiKit.Logging.logDebug(">>> new DirectLoginReference: " + Clipperz.Base.serializeJSON(MochiKit.Base.keys(args))); 36//MochiKit.Logging.logDebug(">>> new DirectLoginReference: " + Clipperz.Base.serializeJSON(MochiKit.Base.keys(args)));
40//MochiKit.Logging.logDebug(">>> new DirectLoginReference - record: " + args.record); 37//MochiKit.Logging.logDebug(">>> new DirectLoginReference - record: " + args.record);
41 this._user = args.user; 38 this._user = args.user;
42 39
43 if (args.directLogin != null) { 40 if (args.directLogin != null) {
44 this._reference = args.directLogin.reference(); 41 this._reference = args.directLogin.reference();
45 this._recordReference = args.directLogin.record().reference(); 42 this._recordReference = args.directLogin.record().reference();
46 this._label = args.directLogin.label(); 43 this._label = args.directLogin.label();
47 this._favicon = args.directLogin.favicon() || null; 44 this._favicon = args.directLogin.favicon() || null;
48 45
49 this._directLogin = args.directLogin; 46 this._directLogin = args.directLogin;
50 this._record = args.directLogin.record(); 47 this._record = args.directLogin.record();
51 } else { 48 } else {
52 this._reference = args.reference; 49 this._reference = args.reference;
53 this._recordReference = args.record; 50 this._recordReference = args.record;
54 this._label = args.label; 51 this._label = args.label;
55 this._favicon = args.favicon || null; 52 this._favicon = args.favicon || null;
56 53
57 this._directLogin = null; 54 this._directLogin = null;
58 this._record = null; 55 this._record = null;
59 } 56 }
60 57
61 this._fixedFavicon = null; 58 this._fixedFavicon = null;
62 59
63 return this; 60 return this;
64} 61}
65 62
66Clipperz.PM.DataModel.DirectLoginReference.prototype = MochiKit.Base.update(null, { 63Clipperz.PM.DataModel.DirectLoginReference.prototype = MochiKit.Base.update(null, {
67 64
68 'user': function() { 65 'user': function() {
69 return this._user; 66 return this._user;
70 }, 67 },
71 68
72 //------------------------------------------------------------------------- 69 //-------------------------------------------------------------------------
73 70
74 'reference': function() { 71 'reference': function() {
75 return this._reference; 72 return this._reference;
76 }, 73 },
77 74
78 //------------------------------------------------------------------------- 75 //-------------------------------------------------------------------------
79 76
80 'synchronizeValues': function(aDirectLogin) { 77 'synchronizeValues': function(aDirectLogin) {
81 this._label = aDirectLogin.label(); 78 this._label = aDirectLogin.label();
82 this._favicon = aDirectLogin.favicon(); 79 this._favicon = aDirectLogin.favicon();
83 }, 80 },
84 81
85 //------------------------------------------------------------------------- 82 //-------------------------------------------------------------------------
86 83
87 'label': function() { 84 'label': function() {
88 return this._label; 85 return this._label;
89 }, 86 },
90 87
91 //------------------------------------------------------------------------- 88 //-------------------------------------------------------------------------
92 89
93 'recordReference': function() { 90 'recordReference': function() {
94 return this._recordReference; 91 return this._recordReference;
95 }, 92 },
96 93
97 //------------------------------------------------------------------------- 94 //-------------------------------------------------------------------------
98 95
99 'record': function() { 96 'record': function() {
100//MochiKit.Logging.logDebug(">>> DirectLoginReference.record"); 97//MochiKit.Logging.logDebug(">>> DirectLoginReference.record");
101 if (this._record == null) { 98 if (this._record == null) {
102 this._record = this.user().records()[this.recordReference()]; 99 this._record = this.user().records()[this.recordReference()];
103 } 100 }
104 101
105//MochiKit.Logging.logDebug("<<< DirectLoginReference.record"); 102//MochiKit.Logging.logDebug("<<< DirectLoginReference.record");
106 return this._record; 103 return this._record;
107 }, 104 },
108 105
109 //------------------------------------------------------------------------- 106 //-------------------------------------------------------------------------
110 107
111 'favicon': function() { 108 'favicon': function() {
112 return this._favicon; 109 return this._favicon;
113 }, 110 },
114 111
115 //------------------------------------------------------------------------- 112 //-------------------------------------------------------------------------
116 113
117 'fixedFavicon': function() { 114 'fixedFavicon': function() {
118 var result; 115 var result;
119 116
120 if (this._fixedFavicon == null) { 117 if (this._fixedFavicon == null) {
diff --git a/frontend/beta/js/Clipperz/PM/DataModel/Header.js b/frontend/beta/js/Clipperz/PM/DataModel/Header.js
index ef34732..c780855 100644
--- a/frontend/beta/js/Clipperz/PM/DataModel/Header.js
+++ b/frontend/beta/js/Clipperz/PM/DataModel/Header.js
@@ -1,120 +1,117 @@
1/* 1/*
2 2
3Copyright 2008-2011 Clipperz Srl 3Copyright 2008-2011 Clipperz Srl
4 4
5This file is part of Clipperz's Javascript Crypto Library. 5This file is part of Clipperz Community Edition.
6Javascript Crypto Library provides web developers with an extensive 6Clipperz Community Edition is an online password manager.
7and efficient set of cryptographic functions. The library aims to
8obtain maximum execution speed while preserving modularity and
9reusability.
10For further information about its features and functionalities please 7For further information about its features and functionalities please
11refer to http://www.clipperz.com 8refer to http://www.clipperz.com.
12 9
13* Javascript Crypto Library is free software: you can redistribute 10* Clipperz Community Edition is free software: you can redistribute
14 it and/or modify it under the terms of the GNU Affero General Public 11 it and/or modify it under the terms of the GNU Affero General Public
15 License as published by the Free Software Foundation, either version 12 License as published by the Free Software Foundation, either version
16 3 of the License, or (at your option) any later version. 13 3 of the License, or (at your option) any later version.
17 14
18* Javascript Crypto Library is distributed in the hope that it will 15* Clipperz Community Edition is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied 16 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 17 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details. 18 See the GNU Affero General Public License for more details.
22 19
23* You should have received a copy of the GNU Affero General Public 20* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see 21 License along with Clipperz Community Edition. If not, see
25 <http://www.gnu.org/licenses/>. 22 <http://www.gnu.org/licenses/>.
26 23
27*/ 24*/
28 25
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } 26if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } 27if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; } 28if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; }
32 29
33 30
34//############################################################################# 31//#############################################################################
35 32
36Clipperz.PM.DataModel.Header = function(args) { 33Clipperz.PM.DataModel.Header = function(args) {
37 args = args || {}; 34 args = args || {};
38 35
39 this._user = args.user; 36 this._user = args.user;
40 37
41 this._serverData = null; 38 this._serverData = null;
42 this._serverDataVersion = null; 39 this._serverDataVersion = null;
43 this._jsonEvaledServerData = null; 40 this._jsonEvaledServerData = null;
44 41
45 this._decryptedLegacyServerData = null; 42 this._decryptedLegacyServerData = null;
46 this._isDecryptingLegacyServerData = false; 43 this._isDecryptingLegacyServerData = false;
47 this._decryptingLegacyServerDataPendingQueue = []; 44 this._decryptingLegacyServerDataPendingQueue = [];
48 45
49 this.resetUpdatedSections(); 46 this.resetUpdatedSections();
50 47
51 this._shouldLoadSections = {}; 48 this._shouldLoadSections = {};
52 49
53 Clipperz.NotificationCenter.register(this.user(), 'updatedSection', this, 'updatedSectionHandler'); 50 Clipperz.NotificationCenter.register(this.user(), 'updatedSection', this, 'updatedSectionHandler');
54 51
55 return this; 52 return this;
56} 53}
57 54
58Clipperz.PM.DataModel.Header.prototype = MochiKit.Base.update(null, { 55Clipperz.PM.DataModel.Header.prototype = MochiKit.Base.update(null, {
59 56
60 //------------------------------------------------------------------------- 57 //-------------------------------------------------------------------------
61 58
62 'user': function() { 59 'user': function() {
63 return this._user; 60 return this._user;
64 }, 61 },
65 62
66 //------------------------------------------------------------------------- 63 //-------------------------------------------------------------------------
67 //------------------------------------------------------------------------- 64 //-------------------------------------------------------------------------
68 //------------------------------------------------------------------------- 65 //-------------------------------------------------------------------------
69 //------------------------------------------------------------------------- 66 //-------------------------------------------------------------------------
70 //------------------------------------------------------------------------- 67 //-------------------------------------------------------------------------
71 //------------------------------------------------------------------------- 68 //-------------------------------------------------------------------------
72 //------------------------------------------------------------------------- 69 //-------------------------------------------------------------------------
73 //------------------------------------------------------------------------- 70 //-------------------------------------------------------------------------
74 //------------------------------------------------------------------------- 71 //-------------------------------------------------------------------------
75 72
76 'updatedSections': function() { 73 'updatedSections': function() {
77 return this._updatedSections; 74 return this._updatedSections;
78 }, 75 },
79 76
80 'markSectionAsUpdated': function(aSectionName) { 77 'markSectionAsUpdated': function(aSectionName) {
81 this.updatedSections().push(aSectionName); 78 this.updatedSections().push(aSectionName);
82 }, 79 },
83 80
84 'resetUpdatedSections': function() { 81 'resetUpdatedSections': function() {
85 this._updatedSections = [] 82 this._updatedSections = []
86 }, 83 },
87 84
88 'hasSectionBeenUpdated': function(aSectionName) { 85 'hasSectionBeenUpdated': function(aSectionName) {
89 return (this.updatedSections().join().indexOf(aSectionName) != -1); 86 return (this.updatedSections().join().indexOf(aSectionName) != -1);
90 }, 87 },
91 88
92 'cachedServerDataSection': function(aSectionName) { 89 'cachedServerDataSection': function(aSectionName) {
93 return (this.hasSectionBeenUpdated(aSectionName)) ? {} : this.jsonEvaledServerData()[aSectionName]; 90 return (this.hasSectionBeenUpdated(aSectionName)) ? {} : this.jsonEvaledServerData()[aSectionName];
94 }, 91 },
95 92
96 'updateAllSections': function() { 93 'updateAllSections': function() {
97 this.resetUpdatedSections(); 94 this.resetUpdatedSections();
98 this.markSectionAsUpdated('records'); 95 this.markSectionAsUpdated('records');
99 this.markSectionAsUpdated('directLogins'); 96 this.markSectionAsUpdated('directLogins');
100 this.markSectionAsUpdated('preferences'); 97 this.markSectionAsUpdated('preferences');
101 this.markSectionAsUpdated('oneTimePasswords'); 98 this.markSectionAsUpdated('oneTimePasswords');
102 99
103 return MochiKit.Async.succeed(this); 100 return MochiKit.Async.succeed(this);
104 }, 101 },
105 102
106 'updatedSectionHandler': function(anEvent) { 103 'updatedSectionHandler': function(anEvent) {
107 this.markSectionAsUpdated(anEvent.parameters()); 104 this.markSectionAsUpdated(anEvent.parameters());
108 }, 105 },
109 106
110 //------------------------------------------------------------------------- 107 //-------------------------------------------------------------------------
111 108
112 'getObjectKeyIndex': function(anObject) { 109 'getObjectKeyIndex': function(anObject) {
113 var result; 110 var result;
114 varitemReference; 111 varitemReference;
115 var index; 112 var index;
116 113
117 result = {}; 114 result = {};
118 index = 0; 115 index = 0;
119 116
120 for (itemReference in anObject) { 117 for (itemReference in anObject) {
diff --git a/frontend/beta/js/Clipperz/PM/DataModel/OneTimePassword.js b/frontend/beta/js/Clipperz/PM/DataModel/OneTimePassword.js
index dd8d5c9..88f383a 100644
--- a/frontend/beta/js/Clipperz/PM/DataModel/OneTimePassword.js
+++ b/frontend/beta/js/Clipperz/PM/DataModel/OneTimePassword.js
@@ -1,120 +1,117 @@
1/* 1/*
2 2
3Copyright 2008-2011 Clipperz Srl 3Copyright 2008-2011 Clipperz Srl
4 4
5This file is part of Clipperz's Javascript Crypto Library. 5This file is part of Clipperz Community Edition.
6Javascript Crypto Library provides web developers with an extensive 6Clipperz Community Edition is an online password manager.
7and efficient set of cryptographic functions. The library aims to
8obtain maximum execution speed while preserving modularity and
9reusability.
10For further information about its features and functionalities please 7For further information about its features and functionalities please
11refer to http://www.clipperz.com 8refer to http://www.clipperz.com.
12 9
13* Javascript Crypto Library is free software: you can redistribute 10* Clipperz Community Edition is free software: you can redistribute
14 it and/or modify it under the terms of the GNU Affero General Public 11 it and/or modify it under the terms of the GNU Affero General Public
15 License as published by the Free Software Foundation, either version 12 License as published by the Free Software Foundation, either version
16 3 of the License, or (at your option) any later version. 13 3 of the License, or (at your option) any later version.
17 14
18* Javascript Crypto Library is distributed in the hope that it will 15* Clipperz Community Edition is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied 16 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 17 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details. 18 See the GNU Affero General Public License for more details.
22 19
23* You should have received a copy of the GNU Affero General Public 20* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see 21 License along with Clipperz Community Edition. If not, see
25 <http://www.gnu.org/licenses/>. 22 <http://www.gnu.org/licenses/>.
26 23
27*/ 24*/
28 25
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } 26if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } 27if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; } 28if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; }
32 29
33 30
34//############################################################################# 31//#############################################################################
35 32
36Clipperz.PM.DataModel.OneTimePassword = function(args) { 33Clipperz.PM.DataModel.OneTimePassword = function(args) {
37 args = args || {}; 34 args = args || {};
38 35
39//console.log("new OneTimePassword", args); 36//console.log("new OneTimePassword", args);
40//MochiKit.Logging.logDebug("---"); 37//MochiKit.Logging.logDebug("---");
41 this._user = args['user']; 38 this._user = args['user'];
42 this._password = args['password']; 39 this._password = args['password'];
43 this._passwordValue = Clipperz.PM.DataModel.OneTimePassword.normalizedOneTimePassword(args['password']); 40 this._passwordValue = Clipperz.PM.DataModel.OneTimePassword.normalizedOneTimePassword(args['password']);
44 this._reference = args['reference'] || Clipperz.PM.Crypto.randomKey(); 41 this._reference = args['reference'] || Clipperz.PM.Crypto.randomKey();
45 this._creationDate = args['created'] ? Clipperz.PM.Date.parseDateWithUTCFormat(args['created']) : new Date(); 42 this._creationDate = args['created'] ? Clipperz.PM.Date.parseDateWithUTCFormat(args['created']) : new Date();
46 this._usageDate = args['used'] ? Clipperz.PM.Date.parseDateWithUTCFormat(args['used']) : null; 43 this._usageDate = args['used'] ? Clipperz.PM.Date.parseDateWithUTCFormat(args['used']) : null;
47 44
48 this._status = args['status'] || 'ACTIVE'; 45 this._status = args['status'] || 'ACTIVE';
49 this._connectionInfo = null; 46 this._connectionInfo = null;
50 47
51 this._key = null; 48 this._key = null;
52 this._keyChecksum = null; 49 this._keyChecksum = null;
53 50
54 return this; 51 return this;
55} 52}
56 53
57Clipperz.PM.DataModel.OneTimePassword.prototype = MochiKit.Base.update(null, { 54Clipperz.PM.DataModel.OneTimePassword.prototype = MochiKit.Base.update(null, {
58 55
59 'toString': function() { 56 'toString': function() {
60 return "Clipperz.PM.DataModel.OneTimePassword"; 57 return "Clipperz.PM.DataModel.OneTimePassword";
61 }, 58 },
62 59
63 //------------------------------------------------------------------------- 60 //-------------------------------------------------------------------------
64 61
65 'user': function() { 62 'user': function() {
66 return this._user; 63 return this._user;
67 }, 64 },
68 65
69 //------------------------------------------------------------------------- 66 //-------------------------------------------------------------------------
70 67
71 'password': function() { 68 'password': function() {
72 return this._password; 69 return this._password;
73 }, 70 },
74 71
75 //------------------------------------------------------------------------- 72 //-------------------------------------------------------------------------
76 73
77 'passwordValue': function() { 74 'passwordValue': function() {
78 return this._passwordValue; 75 return this._passwordValue;
79 }, 76 },
80 77
81 //------------------------------------------------------------------------- 78 //-------------------------------------------------------------------------
82 79
83 'creationDate': function() { 80 'creationDate': function() {
84 return this._creationDate; 81 return this._creationDate;
85 }, 82 },
86 83
87 //------------------------------------------------------------------------- 84 //-------------------------------------------------------------------------
88 85
89 'reference': function() { 86 'reference': function() {
90 return this._reference; 87 return this._reference;
91 }, 88 },
92 89
93 //------------------------------------------------------------------------- 90 //-------------------------------------------------------------------------
94 91
95 'key': function() { 92 'key': function() {
96 if (this._key == null) { 93 if (this._key == null) {
97 this._key = Clipperz.PM.DataModel.OneTimePassword.computeKeyWithUsernameAndPassword(this.user().username(), this.passwordValue()); 94 this._key = Clipperz.PM.DataModel.OneTimePassword.computeKeyWithUsernameAndPassword(this.user().username(), this.passwordValue());
98 } 95 }
99 96
100 return this._key; 97 return this._key;
101 }, 98 },
102 99
103 //------------------------------------------------------------------------- 100 //-------------------------------------------------------------------------
104 101
105 'keyChecksum': function() { 102 'keyChecksum': function() {
106 if (this._keyChecksum == null) { 103 if (this._keyChecksum == null) {
107 this._keyChecksum = Clipperz.PM.DataModel.OneTimePassword.computeKeyChecksumWithUsernameAndPassword(this.user().username(), this.passwordValue()); 104 this._keyChecksum = Clipperz.PM.DataModel.OneTimePassword.computeKeyChecksumWithUsernameAndPassword(this.user().username(), this.passwordValue());
108 } 105 }
109 106
110 return this._keyChecksum; 107 return this._keyChecksum;
111 }, 108 },
112 109
113 //------------------------------------------------------------------------- 110 //-------------------------------------------------------------------------
114 111
115 'status': function() { 112 'status': function() {
116 return this._status; 113 return this._status;
117 }, 114 },
118 115
119 'setStatus': function(aValue) { 116 'setStatus': function(aValue) {
120 this._status = aValue; 117 this._status = aValue;
diff --git a/frontend/beta/js/Clipperz/PM/DataModel/OneTimePasswordManager.js b/frontend/beta/js/Clipperz/PM/DataModel/OneTimePasswordManager.js
index d90100a..aa40aba 100644
--- a/frontend/beta/js/Clipperz/PM/DataModel/OneTimePasswordManager.js
+++ b/frontend/beta/js/Clipperz/PM/DataModel/OneTimePasswordManager.js
@@ -1,120 +1,117 @@
1/* 1/*
2 2
3Copyright 2008-2011 Clipperz Srl 3Copyright 2008-2011 Clipperz Srl
4 4
5This file is part of Clipperz's Javascript Crypto Library. 5This file is part of Clipperz Community Edition.
6Javascript Crypto Library provides web developers with an extensive 6Clipperz Community Edition is an online password manager.
7and efficient set of cryptographic functions. The library aims to
8obtain maximum execution speed while preserving modularity and
9reusability.
10For further information about its features and functionalities please 7For further information about its features and functionalities please
11refer to http://www.clipperz.com 8refer to http://www.clipperz.com.
12 9
13* Javascript Crypto Library is free software: you can redistribute 10* Clipperz Community Edition is free software: you can redistribute
14 it and/or modify it under the terms of the GNU Affero General Public 11 it and/or modify it under the terms of the GNU Affero General Public
15 License as published by the Free Software Foundation, either version 12 License as published by the Free Software Foundation, either version
16 3 of the License, or (at your option) any later version. 13 3 of the License, or (at your option) any later version.
17 14
18* Javascript Crypto Library is distributed in the hope that it will 15* Clipperz Community Edition is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied 16 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 17 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details. 18 See the GNU Affero General Public License for more details.
22 19
23* You should have received a copy of the GNU Affero General Public 20* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see 21 License along with Clipperz Community Edition. If not, see
25 <http://www.gnu.org/licenses/>. 22 <http://www.gnu.org/licenses/>.
26 23
27*/ 24*/
28 25
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } 26if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } 27if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; } 28if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; }
32 29
33 30
34//############################################################################# 31//#############################################################################
35 32
36Clipperz.PM.DataModel.OneTimePasswordManager = function(anUser, args) { 33Clipperz.PM.DataModel.OneTimePasswordManager = function(anUser, args) {
37 args = args || {}; 34 args = args || {};
38 35
39 this._user = anUser; 36 this._user = anUser;
40 this._oneTimePasswords = {}; 37 this._oneTimePasswords = {};
41 38
42 this.updateWithData(args); 39 this.updateWithData(args);
43 40
44 Clipperz.NotificationCenter.notify(null, 'oneTimePasswordAdded', null, true); 41 Clipperz.NotificationCenter.notify(null, 'oneTimePasswordAdded', null, true);
45 42
46 return this; 43 return this;
47} 44}
48 45
49Clipperz.PM.DataModel.OneTimePasswordManager.prototype = MochiKit.Base.update(null, { 46Clipperz.PM.DataModel.OneTimePasswordManager.prototype = MochiKit.Base.update(null, {
50 47
51 'toString': function() { 48 'toString': function() {
52 return "Clipperz.PM.DataModel.OneTimePasswordManager"; 49 return "Clipperz.PM.DataModel.OneTimePasswordManager";
53 }, 50 },
54 51
55 //------------------------------------------------------------------------- 52 //-------------------------------------------------------------------------
56 53
57 'updateWithData': function(someValues) { 54 'updateWithData': function(someValues) {
58 varotpReference; 55 varotpReference;
59 56
60//console.log("OneTimePasswordManager.updateWithData", someValues); 57//console.log("OneTimePasswordManager.updateWithData", someValues);
61//MochiKit.Logging.logDebug("OneTimePasswordManager.updateWithData: " + Clipperz.Base.serializeJSON(someValues)); 58//MochiKit.Logging.logDebug("OneTimePasswordManager.updateWithData: " + Clipperz.Base.serializeJSON(someValues));
62 for (otpReference in someValues) { 59 for (otpReference in someValues) {
63 var otp; 60 var otp;
64 var otpConfiguration; 61 var otpConfiguration;
65 62
66 otpConfiguration = someValues[otpReference]; 63 otpConfiguration = someValues[otpReference];
67 otpConfiguration['user'] = this.user(); 64 otpConfiguration['user'] = this.user();
68 otpConfiguration['reference'] = otpReference; 65 otpConfiguration['reference'] = otpReference;
69 otp = new Clipperz.PM.DataModel.OneTimePassword(otpConfiguration); 66 otp = new Clipperz.PM.DataModel.OneTimePassword(otpConfiguration);
70 this._oneTimePasswords[otpReference] = otp; 67 this._oneTimePasswords[otpReference] = otp;
71 } 68 }
72 69
73 return this; 70 return this;
74 }, 71 },
75 72
76 //------------------------------------------------------------------------- 73 //-------------------------------------------------------------------------
77 74
78 'updateWithServerData': function(someValues) { 75 'updateWithServerData': function(someValues) {
79 var deferredResult; 76 var deferredResult;
80 varoneTimePasswordReference; 77 varoneTimePasswordReference;
81 var wereChangesApplied; 78 var wereChangesApplied;
82 79
83//MochiKit.Logging.logDebug(">>> OneTimePasswordManager.updateWithServerData"); 80//MochiKit.Logging.logDebug(">>> OneTimePasswordManager.updateWithServerData");
84 deferredResult = new MochiKit.Async.Deferred(); 81 deferredResult = new MochiKit.Async.Deferred();
85 wereChangesApplied = false; 82 wereChangesApplied = false;
86 83
87 for (oneTimePasswordReference in someValues) { 84 for (oneTimePasswordReference in someValues) {
88 var oneTimePassword; 85 var oneTimePassword;
89 86
90 oneTimePassword = this.oneTimePasswordWithReference(oneTimePasswordReference); 87 oneTimePassword = this.oneTimePasswordWithReference(oneTimePasswordReference);
91 if (oneTimePassword != null) { 88 if (oneTimePassword != null) {
92 var oneTimePasswordHasBeenUpdated; 89 var oneTimePasswordHasBeenUpdated;
93 90
94 oneTimePasswordHasBeenUpdated = oneTimePassword.updateStatusWithValues(someValues[oneTimePasswordReference]); 91 oneTimePasswordHasBeenUpdated = oneTimePassword.updateStatusWithValues(someValues[oneTimePasswordReference]);
95 wereChangesApplied = oneTimePasswordHasBeenUpdated || wereChangesApplied; 92 wereChangesApplied = oneTimePasswordHasBeenUpdated || wereChangesApplied;
96 } else { 93 } else {
97 94
98 } 95 }
99 } 96 }
100 97
101 if (wereChangesApplied == true) { 98 if (wereChangesApplied == true) {
102 this.user().header().markSectionAsUpdated('oneTimePasswords'); 99 this.user().header().markSectionAsUpdated('oneTimePasswords');
103 } 100 }
104 101
105 for (oneTimePasswordReference in this.oneTimePasswords()) { 102 for (oneTimePasswordReference in this.oneTimePasswords()) {
106 if (typeof(someValues[oneTimePasswordReference]) == 'undefind') { 103 if (typeof(someValues[oneTimePasswordReference]) == 'undefind') {
107 deferredResult.addCallback(MochiKit.Base.method(this.oneTimePasswordWithReference(oneTimePasswordReference), 'saveChanges')); 104 deferredResult.addCallback(MochiKit.Base.method(this.oneTimePasswordWithReference(oneTimePasswordReference), 'saveChanges'));
108 } 105 }
109 } 106 }
110 107
111 deferredResult.addCallback(MochiKit.Async.succeed, this); 108 deferredResult.addCallback(MochiKit.Async.succeed, this);
112 109
113 deferredResult.callback(); 110 deferredResult.callback();
114//MochiKit.Logging.logDebug("<<< OneTimePasswordManager.updateWithServerData"); 111//MochiKit.Logging.logDebug("<<< OneTimePasswordManager.updateWithServerData");
115 112
116 return deferredResult; 113 return deferredResult;
117 }, 114 },
118 115
119 //------------------------------------------------------------------------- 116 //-------------------------------------------------------------------------
120 117
diff --git a/frontend/beta/js/Clipperz/PM/DataModel/Record.js b/frontend/beta/js/Clipperz/PM/DataModel/Record.js
index b4b5023..270f2ae 100644
--- a/frontend/beta/js/Clipperz/PM/DataModel/Record.js
+++ b/frontend/beta/js/Clipperz/PM/DataModel/Record.js
@@ -1,120 +1,117 @@
1/* 1/*
2 2
3Copyright 2008-2011 Clipperz Srl 3Copyright 2008-2011 Clipperz Srl
4 4
5This file is part of Clipperz's Javascript Crypto Library. 5This file is part of Clipperz Community Edition.
6Javascript Crypto Library provides web developers with an extensive 6Clipperz Community Edition is an online password manager.
7and efficient set of cryptographic functions. The library aims to
8obtain maximum execution speed while preserving modularity and
9reusability.
10For further information about its features and functionalities please 7For further information about its features and functionalities please
11refer to http://www.clipperz.com 8refer to http://www.clipperz.com.
12 9
13* Javascript Crypto Library is free software: you can redistribute 10* Clipperz Community Edition is free software: you can redistribute
14 it and/or modify it under the terms of the GNU Affero General Public 11 it and/or modify it under the terms of the GNU Affero General Public
15 License as published by the Free Software Foundation, either version 12 License as published by the Free Software Foundation, either version
16 3 of the License, or (at your option) any later version. 13 3 of the License, or (at your option) any later version.
17 14
18* Javascript Crypto Library is distributed in the hope that it will 15* Clipperz Community Edition is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied 16 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 17 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details. 18 See the GNU Affero General Public License for more details.
22 19
23* You should have received a copy of the GNU Affero General Public 20* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see 21 License along with Clipperz Community Edition. If not, see
25 <http://www.gnu.org/licenses/>. 22 <http://www.gnu.org/licenses/>.
26 23
27*/ 24*/
28 25
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } 26if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } 27if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; } 28if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; }
32 29
33 30
34//############################################################################# 31//#############################################################################
35 32
36Clipperz.PM.DataModel.Record = function(args) { 33Clipperz.PM.DataModel.Record = function(args) {
37 args = args || {}; 34 args = args || {};
38 35
39 this._user = args['user'] || null; 36 this._user = args['user'] || null;
40 this._reference = args['reference'] || Clipperz.PM.Crypto.randomKey(); 37 this._reference = args['reference'] || Clipperz.PM.Crypto.randomKey();
41 this._version = args['version'] || Clipperz.PM.Crypto.encryptingFunctions.currentVersion; 38 this._version = args['version'] || Clipperz.PM.Crypto.encryptingFunctions.currentVersion;
42 this._key = args['key'] || Clipperz.PM.Crypto.randomKey(); 39 this._key = args['key'] || Clipperz.PM.Crypto.randomKey();
43 40
44 this.setLabel(args['label'] || Clipperz.PM.Strings['newRecordTitleLabel']); 41 this.setLabel(args['label'] || Clipperz.PM.Strings['newRecordTitleLabel']);
45 42
46 this.setHeaderNotes(args['headerNotes'] || null); 43 this.setHeaderNotes(args['headerNotes'] || null);
47 this.setNotes(args['notes'] || args['headerNotes'] || ""); 44 this.setNotes(args['notes'] || args['headerNotes'] || "");
48//MochiKit.Logging.logDebug("--- new Record ('" + this._label + "')- _headerNotes: '" + this._headerNotes + "'"); 45//MochiKit.Logging.logDebug("--- new Record ('" + this._label + "')- _headerNotes: '" + this._headerNotes + "'");
49//MochiKit.Logging.logDebug("--- new Record ('" + this._label + "')- _notes: '" + this._notes + "'"); 46//MochiKit.Logging.logDebug("--- new Record ('" + this._label + "')- _notes: '" + this._notes + "'");
50 //this._notes = args.notes || ""; 47 //this._notes = args.notes || "";
51 48
52 this._versions = {}; 49 this._versions = {};
53 this._directLogins = {}; 50 this._directLogins = {};
54 this._removedDirectLogins = []; 51 this._removedDirectLogins = [];
55 52
56 this.setIsBrandNew(args['reference'] == null); 53 this.setIsBrandNew(args['reference'] == null);
57 54
58 this.setShouldLoadData(this.isBrandNew() ? false: true); 55 this.setShouldLoadData(this.isBrandNew() ? false: true);
59 this.setShouldDecryptData(this.isBrandNew() ? false: true); 56 this.setShouldDecryptData(this.isBrandNew() ? false: true);
60 this.setShouldProcessData(this.isBrandNew() ? false: true); 57 this.setShouldProcessData(this.isBrandNew() ? false: true);
61 58
62 this.setCurrentVersion(this.isBrandNew() ? new Clipperz.PM.DataModel.RecordVersion(this, null): null); 59 this.setCurrentVersion(this.isBrandNew() ? new Clipperz.PM.DataModel.RecordVersion(this, null): null);
63 this.setCurrentVersionKey(null); 60 this.setCurrentVersionKey(null);
64 61
65 this._serverData = null; 62 this._serverData = null;
66 this._decryptedData = null; 63 this._decryptedData = null;
67 this._cachedData = null; 64 this._cachedData = null;
68 65
69 return this; 66 return this;
70} 67}
71 68
72Clipperz.PM.DataModel.Record.prototype = MochiKit.Base.update(null, { 69Clipperz.PM.DataModel.Record.prototype = MochiKit.Base.update(null, {
73 70
74 'toString': function() { 71 'toString': function() {
75 return "Record (" + this.label() + ")"; 72 return "Record (" + this.label() + ")";
76 }, 73 },
77 74
78 //------------------------------------------------------------------------- 75 //-------------------------------------------------------------------------
79 76
80 'isBrandNew': function() { 77 'isBrandNew': function() {
81 return this._isBrandNew; 78 return this._isBrandNew;
82 }, 79 },
83 80
84 'setIsBrandNew': function(aValue) { 81 'setIsBrandNew': function(aValue) {
85 this._isBrandNew = aValue; 82 this._isBrandNew = aValue;
86 }, 83 },
87 84
88 //------------------------------------------------------------------------- 85 //-------------------------------------------------------------------------
89/* 86/*
90 'shouldRunTheRecordCreationWizard': function() { 87 'shouldRunTheRecordCreationWizard': function() {
91 return (this.isBrandNew() && (MochiKit.Base.keys(this.currentVersion().fields()).length == 0)); 88 return (this.isBrandNew() && (MochiKit.Base.keys(this.currentVersion().fields()).length == 0));
92 }, 89 },
93 */ 90 */
94 //------------------------------------------------------------------------- 91 //-------------------------------------------------------------------------
95 92
96 'user': function() { 93 'user': function() {
97 return this._user; 94 return this._user;
98 }, 95 },
99 96
100 //------------------------------------------------------------------------- 97 //-------------------------------------------------------------------------
101 98
102 'reference': function() { 99 'reference': function() {
103 return this._reference; 100 return this._reference;
104 }, 101 },
105 102
106 //------------------------------------------------------------------------- 103 //-------------------------------------------------------------------------
107 104
108 'key': function() { 105 'key': function() {
109 return this._key; 106 return this._key;
110 }, 107 },
111 108
112 'updateKey': function() { 109 'updateKey': function() {
113 this._key = Clipperz.PM.Crypto.randomKey(); 110 this._key = Clipperz.PM.Crypto.randomKey();
114 }, 111 },
115 112
116 //------------------------------------------------------------------------- 113 //-------------------------------------------------------------------------
117 114
118 'label': function() { 115 'label': function() {
119 return this._label; 116 return this._label;
120 }, 117 },
diff --git a/frontend/beta/js/Clipperz/PM/DataModel/RecordField.js b/frontend/beta/js/Clipperz/PM/DataModel/RecordField.js
index 2063825..bca664d 100644
--- a/frontend/beta/js/Clipperz/PM/DataModel/RecordField.js
+++ b/frontend/beta/js/Clipperz/PM/DataModel/RecordField.js
@@ -1,120 +1,117 @@
1/* 1/*
2 2
3Copyright 2008-2011 Clipperz Srl 3Copyright 2008-2011 Clipperz Srl
4 4
5This file is part of Clipperz's Javascript Crypto Library. 5This file is part of Clipperz Community Edition.
6Javascript Crypto Library provides web developers with an extensive 6Clipperz Community Edition is an online password manager.
7and efficient set of cryptographic functions. The library aims to
8obtain maximum execution speed while preserving modularity and
9reusability.
10For further information about its features and functionalities please 7For further information about its features and functionalities please
11refer to http://www.clipperz.com 8refer to http://www.clipperz.com.
12 9
13* Javascript Crypto Library is free software: you can redistribute 10* Clipperz Community Edition is free software: you can redistribute
14 it and/or modify it under the terms of the GNU Affero General Public 11 it and/or modify it under the terms of the GNU Affero General Public
15 License as published by the Free Software Foundation, either version 12 License as published by the Free Software Foundation, either version
16 3 of the License, or (at your option) any later version. 13 3 of the License, or (at your option) any later version.
17 14
18* Javascript Crypto Library is distributed in the hope that it will 15* Clipperz Community Edition is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied 16 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 17 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details. 18 See the GNU Affero General Public License for more details.
22 19
23* You should have received a copy of the GNU Affero General Public 20* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see 21 License along with Clipperz Community Edition. If not, see
25 <http://www.gnu.org/licenses/>. 22 <http://www.gnu.org/licenses/>.
26 23
27*/ 24*/
28 25
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } 26if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } 27if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; } 28if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; }
32 29
33//############################################################################# 30//#############################################################################
34 31
35Clipperz.PM.DataModel.RecordField = function(args) { 32Clipperz.PM.DataModel.RecordField = function(args) {
36 args = args || {}; 33 args = args || {};
37 34
38 this._recordVersion = args.recordVersion || null; 35 this._recordVersion = args.recordVersion || null;
39 this._key = args.key || Clipperz.PM.Crypto.randomKey(); 36 this._key = args.key || Clipperz.PM.Crypto.randomKey();
40 this.setLabel(args.label || ''); 37 this.setLabel(args.label || '');
41 this.setValue(args.value || ''); 38 this.setValue(args.value || '');
42 this.setType(args.type || 'TXT'); //valid types: 'TXT', 'PWD', 'URL', 'DATE', 'ADDR', 'CHECK', 'RADIO', ('NOTE' probably not), ... 39 this.setType(args.type || 'TXT'); //valid types: 'TXT', 'PWD', 'URL', 'DATE', 'ADDR', 'CHECK', 'RADIO', ('NOTE' probably not), ...
43 this._hidden = args.hidden || (args.type == 'PWD') || false; 40 this._hidden = args.hidden || (args.type == 'PWD') || false;
44 41
45 return this; 42 return this;
46} 43}
47 44
48Clipperz.PM.DataModel.RecordField.prototype = MochiKit.Base.update(null, { 45Clipperz.PM.DataModel.RecordField.prototype = MochiKit.Base.update(null, {
49 46
50 'toString': function() { 47 'toString': function() {
51 return "Clipperz.PM.DataModel.RecordField - " + this.label() + " (" + this.key() + ")"; 48 return "Clipperz.PM.DataModel.RecordField - " + this.label() + " (" + this.key() + ")";
52 }, 49 },
53 50
54 //------------------------------------------------------------------------- 51 //-------------------------------------------------------------------------
55 52
56 'recordVersion': function() { 53 'recordVersion': function() {
57 return this._recordVersion; 54 return this._recordVersion;
58 }, 55 },
59 56
60 //------------------------------------------------------------------------- 57 //-------------------------------------------------------------------------
61 58
62 'key': function() { 59 'key': function() {
63 return this._key; 60 return this._key;
64 }, 61 },
65 62
66 //------------------------------------------------------------------------- 63 //-------------------------------------------------------------------------
67 64
68 'label': function() { 65 'label': function() {
69 return this._label; 66 return this._label;
70 }, 67 },
71 68
72 'setLabel': function(aValue) { 69 'setLabel': function(aValue) {
73 this._label = aValue; 70 this._label = aValue;
74 }, 71 },
75 72
76 //------------------------------------------------------------------------- 73 //-------------------------------------------------------------------------
77 74
78 'value': function() { 75 'value': function() {
79 return this._value; 76 return this._value;
80 }, 77 },
81 78
82 'setValue': function(aValue) { 79 'setValue': function(aValue) {
83 this._value = aValue; 80 this._value = aValue;
84 }, 81 },
85 82
86 //------------------------------------------------------------------------- 83 //-------------------------------------------------------------------------
87 84
88 'type': function() { 85 'type': function() {
89 return this._type; 86 return this._type;
90 }, 87 },
91 88
92 'setType': function(aValue) { 89 'setType': function(aValue) {
93 this._type = aValue; 90 this._type = aValue;
94 91
95 if (aValue == 'PWD') { 92 if (aValue == 'PWD') {
96 this.setHidden(true); 93 this.setHidden(true);
97 } else { 94 } else {
98 this.setHidden(false); 95 this.setHidden(false);
99 } 96 }
100 }, 97 },
101 98
102 //------------------------------------------------------------------------- 99 //-------------------------------------------------------------------------
103 100
104 'serializeData': function() { 101 'serializeData': function() {
105 var result; 102 var result;
106 103
107//MochiKit.Logging.logDebug(">>> RecordField.serializeData - " + this); 104//MochiKit.Logging.logDebug(">>> RecordField.serializeData - " + this);
108 result = { 105 result = {
109 label: this.label(), 106 label: this.label(),
110 value:this.value(), 107 value:this.value(),
111 type: this.type(), 108 type: this.type(),
112 hidden: this.hidden() 109 hidden: this.hidden()
113 }; 110 };
114//MochiKit.Logging.logDebug("<<< RecordField.serializeData"); 111//MochiKit.Logging.logDebug("<<< RecordField.serializeData");
115 112
116 return result; 113 return result;
117 }, 114 },
118 115
119 //------------------------------------------------------------------------- 116 //-------------------------------------------------------------------------
120 117
diff --git a/frontend/beta/js/Clipperz/PM/DataModel/RecordVersion.js b/frontend/beta/js/Clipperz/PM/DataModel/RecordVersion.js
index d2b3e12..fc4a45c 100644
--- a/frontend/beta/js/Clipperz/PM/DataModel/RecordVersion.js
+++ b/frontend/beta/js/Clipperz/PM/DataModel/RecordVersion.js
@@ -1,120 +1,117 @@
1/* 1/*
2 2
3Copyright 2008-2011 Clipperz Srl 3Copyright 2008-2011 Clipperz Srl
4 4
5This file is part of Clipperz's Javascript Crypto Library. 5This file is part of Clipperz Community Edition.
6Javascript Crypto Library provides web developers with an extensive 6Clipperz Community Edition is an online password manager.
7and efficient set of cryptographic functions. The library aims to
8obtain maximum execution speed while preserving modularity and
9reusability.
10For further information about its features and functionalities please 7For further information about its features and functionalities please
11refer to http://www.clipperz.com 8refer to http://www.clipperz.com.
12 9
13* Javascript Crypto Library is free software: you can redistribute 10* Clipperz Community Edition is free software: you can redistribute
14 it and/or modify it under the terms of the GNU Affero General Public 11 it and/or modify it under the terms of the GNU Affero General Public
15 License as published by the Free Software Foundation, either version 12 License as published by the Free Software Foundation, either version
16 3 of the License, or (at your option) any later version. 13 3 of the License, or (at your option) any later version.
17 14
18* Javascript Crypto Library is distributed in the hope that it will 15* Clipperz Community Edition is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied 16 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 17 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details. 18 See the GNU Affero General Public License for more details.
22 19
23* You should have received a copy of the GNU Affero General Public 20* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see 21 License along with Clipperz Community Edition. If not, see
25 <http://www.gnu.org/licenses/>. 22 <http://www.gnu.org/licenses/>.
26 23
27*/ 24*/
28 25
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } 26if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } 27if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; } 28if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; }
32 29
33 30
34//############################################################################# 31//#############################################################################
35 32
36Clipperz.PM.DataModel.RecordVersion = function(aRecord, args) { 33Clipperz.PM.DataModel.RecordVersion = function(aRecord, args) {
37 args = args || {}; 34 args = args || {};
38 35
39 this._record = aRecord; 36 this._record = aRecord;
40 37
41 this._reference = args.reference || Clipperz.PM.Crypto.randomKey(); 38 this._reference = args.reference || Clipperz.PM.Crypto.randomKey();
42 this._version = args.version || Clipperz.PM.Crypto.encryptingFunctions.currentVersion; 39 this._version = args.version || Clipperz.PM.Crypto.encryptingFunctions.currentVersion;
43 this._key = args.key || Clipperz.PM.Crypto.randomKey();; 40 this._key = args.key || Clipperz.PM.Crypto.randomKey();;
44 41
45 this._previousVersion = args.previousVersion || null; 42 this._previousVersion = args.previousVersion || null;
46 this._previousVersionKey = args.previousVersionKey || null; 43 this._previousVersionKey = args.previousVersionKey || null;
47 44
48 this.setIsBrandNew(args.reference == null); 45 this.setIsBrandNew(args.reference == null);
49 46
50 if (this.isBrandNew()) { 47 if (this.isBrandNew()) {
51 this._fields = {}; 48 this._fields = {};
52 49
53 this.setShouldLoadData(false); 50 this.setShouldLoadData(false);
54 this.setShouldDecryptData(false); 51 this.setShouldDecryptData(false);
55 this.setShouldProcessData(false); 52 this.setShouldProcessData(false);
56 } else { 53 } else {
57 if (typeof(args.fields) != 'undefined') { 54 if (typeof(args.fields) != 'undefined') {
58 this.processFieldData(args.fields); 55 this.processFieldData(args.fields);
59 56
60 this.setShouldLoadData(false); 57 this.setShouldLoadData(false);
61 this.setShouldDecryptData(false); 58 this.setShouldDecryptData(false);
62 this.setShouldProcessData(false); 59 this.setShouldProcessData(false);
63 } else { 60 } else {
64 if (typeof(args.data) != 'undefined') { 61 if (typeof(args.data) != 'undefined') {
65 this.setShouldLoadData(false); 62 this.setShouldLoadData(false);
66 } else { 63 } else {
67 this.setShouldLoadData(true); 64 this.setShouldLoadData(true);
68 } 65 }
69 this.setShouldDecryptData(true); 66 this.setShouldDecryptData(true);
70 this.setShouldProcessData(true); 67 this.setShouldProcessData(true);
71 } 68 }
72 } 69 }
73 70
74 this._serverData = args.data; 71 this._serverData = args.data;
75 this._decryptedData = null; 72 this._decryptedData = null;
76 73
77 return this; 74 return this;
78} 75}
79 76
80Clipperz.PM.DataModel.RecordVersion.prototype = MochiKit.Base.update(null, { 77Clipperz.PM.DataModel.RecordVersion.prototype = MochiKit.Base.update(null, {
81 78
82 'toString': function() { 79 'toString': function() {
83 return "RecordVersion"; 80 return "RecordVersion";
84 }, 81 },
85 82
86 //------------------------------------------------------------------------- 83 //-------------------------------------------------------------------------
87 84
88 'record': function() { 85 'record': function() {
89 return this._record; 86 return this._record;
90 }, 87 },
91 88
92 //------------------------------------------------------------------------- 89 //-------------------------------------------------------------------------
93 90
94 'reference': function() { 91 'reference': function() {
95 return this._reference; 92 return this._reference;
96 }, 93 },
97 94
98 'setReference': function(aValue) { 95 'setReference': function(aValue) {
99 this._reference = aValue; 96 this._reference = aValue;
100 }, 97 },
101 98
102 //------------------------------------------------------------------------- 99 //-------------------------------------------------------------------------
103 100
104 'key': function() { 101 'key': function() {
105//MochiKit.Logging.logDebug(">>> RecordVersion.key"); 102//MochiKit.Logging.logDebug(">>> RecordVersion.key");
106//MochiKit.Logging.logDebug("--- RecordVersion.key - " + this._key); 103//MochiKit.Logging.logDebug("--- RecordVersion.key - " + this._key);
107 return this._key; 104 return this._key;
108 }, 105 },
109 106
110 'setKey': function(aValue) { 107 'setKey': function(aValue) {
111 this._key = aValue; 108 this._key = aValue;
112 }, 109 },
113 110
114 //------------------------------------------------------------------------- 111 //-------------------------------------------------------------------------
115 112
116 'serverData': function() { 113 'serverData': function() {
117 return this._serverData; 114 return this._serverData;
118 }, 115 },
119 116
120 'setServerData': function(aValue) { 117 'setServerData': function(aValue) {
diff --git a/frontend/beta/js/Clipperz/PM/DataModel/Statistics.js b/frontend/beta/js/Clipperz/PM/DataModel/Statistics.js
index fb5eb01..3d53adf 100644
--- a/frontend/beta/js/Clipperz/PM/DataModel/Statistics.js
+++ b/frontend/beta/js/Clipperz/PM/DataModel/Statistics.js
@@ -1,120 +1,117 @@
1/* 1/*
2 2
3Copyright 2008-2011 Clipperz Srl 3Copyright 2008-2011 Clipperz Srl
4 4
5This file is part of Clipperz's Javascript Crypto Library. 5This file is part of Clipperz Community Edition.
6Javascript Crypto Library provides web developers with an extensive 6Clipperz Community Edition is an online password manager.
7and efficient set of cryptographic functions. The library aims to
8obtain maximum execution speed while preserving modularity and
9reusability.
10For further information about its features and functionalities please 7For further information about its features and functionalities please
11refer to http://www.clipperz.com 8refer to http://www.clipperz.com.
12 9
13* Javascript Crypto Library is free software: you can redistribute 10* Clipperz Community Edition is free software: you can redistribute
14 it and/or modify it under the terms of the GNU Affero General Public 11 it and/or modify it under the terms of the GNU Affero General Public
15 License as published by the Free Software Foundation, either version 12 License as published by the Free Software Foundation, either version
16 3 of the License, or (at your option) any later version. 13 3 of the License, or (at your option) any later version.
17 14
18* Javascript Crypto Library is distributed in the hope that it will 15* Clipperz Community Edition is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied 16 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 17 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details. 18 See the GNU Affero General Public License for more details.
22 19
23* You should have received a copy of the GNU Affero General Public 20* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see 21 License along with Clipperz Community Edition. If not, see
25 <http://www.gnu.org/licenses/>. 22 <http://www.gnu.org/licenses/>.
26 23
27*/ 24*/
28 25
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } 26if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } 27if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; } 28if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; }
32 29
33 30
34//############################################################################# 31//#############################################################################
35 32
36Clipperz.PM.DataModel.Statistics = function(args) { 33Clipperz.PM.DataModel.Statistics = function(args) {
37 args = args || {}; 34 args = args || {};
38 35
39 this._user = args.user; 36 this._user = args.user;
40 this._data = args.data || null; 37 this._data = args.data || null;
41 38
42 return this; 39 return this;
43} 40}
44 41
45Clipperz.PM.DataModel.Statistics.prototype = MochiKit.Base.update(null, { 42Clipperz.PM.DataModel.Statistics.prototype = MochiKit.Base.update(null, {
46 43
47 //------------------------------------------------------------------------- 44 //-------------------------------------------------------------------------
48 45
49 'decrypt': function(aVersion, someEncryptedData) { 46 'decrypt': function(aVersion, someEncryptedData) {
50 var deferredResult; 47 var deferredResult;
51 48
52//MochiKit.Logging.logDebug(">>> Statistics.decrypt"); 49//MochiKit.Logging.logDebug(">>> Statistics.decrypt");
53 if (someEncryptedData == Clipperz.PM.Crypto.nullValue) { 50 if (someEncryptedData == Clipperz.PM.Crypto.nullValue) {
54 this.setData({}); 51 this.setData({});
55 deferredResult = MochiKit.Async.succeed(this.data()); 52 deferredResult = MochiKit.Async.succeed(this.data());
56 } else { 53 } else {
57 varstatistic; 54 varstatistic;
58 var user; 55 var user;
59 56
60 statistic = this; 57 statistic = this;
61 user = this.user(); 58 user = this.user();
62 deferredResult = new MochiKit.Async.Deferred(); 59 deferredResult = new MochiKit.Async.Deferred();
63//deferredResult.addCallback(function() { console.time("Statistics.decrypt.deferredDecrypt")}); 60//deferredResult.addCallback(function() { console.time("Statistics.decrypt.deferredDecrypt")});
64 deferredResult.addCallback(Clipperz.PM.Crypto.deferredDecrypt, user.passphrase(), someEncryptedData, aVersion); 61 deferredResult.addCallback(Clipperz.PM.Crypto.deferredDecrypt, user.passphrase(), someEncryptedData, aVersion);
65//deferredResult.addCallback(function() { console.timeEnd("Statistics.decrypt.deferredDecrypt")}); 62//deferredResult.addCallback(function() { console.timeEnd("Statistics.decrypt.deferredDecrypt")});
66//deferredResult.addCallback(function() { console.time("Statistics.decrypt.setup")}); 63//deferredResult.addCallback(function() { console.time("Statistics.decrypt.setup")});
67 deferredResult.addCallbacks( 64 deferredResult.addCallbacks(
68 MochiKit.Base.partial(function (aStatistic, someData) { 65 MochiKit.Base.partial(function (aStatistic, someData) {
69 aStatistic.setData(someData); 66 aStatistic.setData(someData);
70 return aStatistic.data(); 67 return aStatistic.data();
71 }, statistic), 68 }, statistic),
72 MochiKit.Base.partial(function (aStatistic) { 69 MochiKit.Base.partial(function (aStatistic) {
73 MochiKit.Logging.logWarning("resetting user statistics due to an error while decrypting stored data"); 70 MochiKit.Logging.logWarning("resetting user statistics due to an error while decrypting stored data");
74 aStatistic.setData({}); 71 aStatistic.setData({});
75 return aStatistic.data(); 72 return aStatistic.data();
76 }, statistic) 73 }, statistic)
77 ); 74 );
78//deferredResult.addCallback(function() { console.timeEnd("Statistics.decrypt.setup")}); 75//deferredResult.addCallback(function() { console.timeEnd("Statistics.decrypt.setup")});
79 76
80 deferredResult.callback(); 77 deferredResult.callback();
81 } 78 }
82//MochiKit.Logging.logDebug("<<< Statistics.decrypt"); 79//MochiKit.Logging.logDebug("<<< Statistics.decrypt");
83 80
84 return deferredResult; 81 return deferredResult;
85 }, 82 },
86 83
87 //------------------------------------------------------------------------- 84 //-------------------------------------------------------------------------
88 85
89 'user': function() { 86 'user': function() {
90 return this._user; 87 return this._user;
91 }, 88 },
92 89
93 //------------------------------------------------------------------------- 90 //-------------------------------------------------------------------------
94 91
95 'data': function() { 92 'data': function() {
96 return this._data; 93 return this._data;
97 }, 94 },
98 95
99 'setData': function(aValue) { 96 'setData': function(aValue) {
100 this._data = aValue; 97 this._data = aValue;
101 98
102 this.extractInfoFromData(aValue); 99 this.extractInfoFromData(aValue);
103 }, 100 },
104 101
105 //------------------------------------------------------------------------- 102 //-------------------------------------------------------------------------
106 103
107 'extractInfoFromData': function(someValues) { 104 'extractInfoFromData': function(someValues) {
108 105
109 }, 106 },
110 107
111 //------------------------------------------------------------------------- 108 //-------------------------------------------------------------------------
112 109
113 'encryptedData': function() { 110 'encryptedData': function() {
114 return Clipperz.PM.Crypto.deferredEncryptWithCurrentVersion(this.user().passphrase(), this.serializedData()); 111 return Clipperz.PM.Crypto.deferredEncryptWithCurrentVersion(this.user().passphrase(), this.serializedData());
115 }, 112 },
116 113
117 //------------------------------------------------------------------------- 114 //-------------------------------------------------------------------------
118 115
119 'serializedData': function() { 116 'serializedData': function() {
120 var result; 117 var result;
diff --git a/frontend/beta/js/Clipperz/PM/DataModel/User.js b/frontend/beta/js/Clipperz/PM/DataModel/User.js
index 5aaaff7..dbbe9a0 100644
--- a/frontend/beta/js/Clipperz/PM/DataModel/User.js
+++ b/frontend/beta/js/Clipperz/PM/DataModel/User.js
@@ -1,120 +1,117 @@
1/* 1/*
2 2
3Copyright 2008-2011 Clipperz Srl 3Copyright 2008-2011 Clipperz Srl
4 4
5This file is part of Clipperz's Javascript Crypto Library. 5This file is part of Clipperz Community Edition.
6Javascript Crypto Library provides web developers with an extensive 6Clipperz Community Edition is an online password manager.
7and efficient set of cryptographic functions. The library aims to
8obtain maximum execution speed while preserving modularity and
9reusability.
10For further information about its features and functionalities please 7For further information about its features and functionalities please
11refer to http://www.clipperz.com 8refer to http://www.clipperz.com.
12 9
13* Javascript Crypto Library is free software: you can redistribute 10* Clipperz Community Edition is free software: you can redistribute
14 it and/or modify it under the terms of the GNU Affero General Public 11 it and/or modify it under the terms of the GNU Affero General Public
15 License as published by the Free Software Foundation, either version 12 License as published by the Free Software Foundation, either version
16 3 of the License, or (at your option) any later version. 13 3 of the License, or (at your option) any later version.
17 14
18* Javascript Crypto Library is distributed in the hope that it will 15* Clipperz Community Edition is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied 16 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 17 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details. 18 See the GNU Affero General Public License for more details.
22 19
23* You should have received a copy of the GNU Affero General Public 20* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see 21 License along with Clipperz Community Edition. If not, see
25 <http://www.gnu.org/licenses/>. 22 <http://www.gnu.org/licenses/>.
26 23
27*/ 24*/
28 25
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } 26if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } 27if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; } 28if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; }
32 29
33 30
34//############################################################################# 31//#############################################################################
35 32
36Clipperz.PM.DataModel.User = function(args) { 33Clipperz.PM.DataModel.User = function(args) {
37//MochiKit.Logging.logDebug(">>> new User"); 34//MochiKit.Logging.logDebug(">>> new User");
38 args = args || {}; 35 args = args || {};
39 36
40 this._username = args.username || null; 37 this._username = args.username || null;
41 this._passphrase = args.passphrase || null; 38 this._passphrase = args.passphrase || null;
42 39
43 this._connection = null; 40 this._connection = null;
44 this._connectionVersion = 'current'; 41 this._connectionVersion = 'current';
45 42
46 this._header = null; 43 this._header = null;
47 this._statistics = null; 44 this._statistics = null;
48 this._lock = 'new lock'; 45 this._lock = 'new lock';
49 46
50 this._preferences = null; 47 this._preferences = null;
51 this._records = {}; 48 this._records = {};
52 this._directLoginReferences = {}; 49 this._directLoginReferences = {};
53 this._oneTimePasswordManager = null; 50 this._oneTimePasswordManager = null;
54 51
55 this._isLoadingUserDetails = false; 52 this._isLoadingUserDetails = false;
56 this._loadingUserDetailsPendingQueue = []; 53 this._loadingUserDetailsPendingQueue = [];
57 54
58 this._maxNumberOfRecords = Number.MAX_VALUE; 55 this._maxNumberOfRecords = Number.MAX_VALUE;
59 56
60 this._shouldDownloadOfflineCopy = false; 57 this._shouldDownloadOfflineCopy = false;
61 58
62 this._loginInfo = null; 59 this._loginInfo = null;
63 this._loginHistory = null; 60 this._loginHistory = null;
64 61
65 this._serverData = null; 62 this._serverData = null;
66//MochiKit.Logging.logDebug("<<< new User"); 63//MochiKit.Logging.logDebug("<<< new User");
67 64
68 return this; 65 return this;
69} 66}
70 67
71Clipperz.PM.DataModel.User.prototype = MochiKit.Base.update(null, { 68Clipperz.PM.DataModel.User.prototype = MochiKit.Base.update(null, {
72 69
73 'toString': function() { 70 'toString': function() {
74 return "Clipperz.PM.DataModel.User - " + this.username(); 71 return "Clipperz.PM.DataModel.User - " + this.username();
75 }, 72 },
76 73
77 //------------------------------------------------------------------------- 74 //-------------------------------------------------------------------------
78 75
79 'username': function() { 76 'username': function() {
80 return this._username; 77 return this._username;
81 }, 78 },
82 79
83 'setUsername': function(aValue) { 80 'setUsername': function(aValue) {
84 this._username = aValue; 81 this._username = aValue;
85 }, 82 },
86 83
87 //------------------------------------------------------------------------- 84 //-------------------------------------------------------------------------
88 85
89 'passphrase': function() { 86 'passphrase': function() {
90 return this._passphrase; 87 return this._passphrase;
91 }, 88 },
92 89
93 'setPassphrase': function(aValue) { 90 'setPassphrase': function(aValue) {
94 this._passphrase = aValue; 91 this._passphrase = aValue;
95 }, 92 },
96 93
97 //------------------------------------------------------------------------- 94 //-------------------------------------------------------------------------
98 95
99 'maxNumberOfRecords': function() { 96 'maxNumberOfRecords': function() {
100 return this._maxNumberOfRecords; 97 return this._maxNumberOfRecords;
101 }, 98 },
102 99
103 'setMaxNumberOfRecords': function(aValue) { 100 'setMaxNumberOfRecords': function(aValue) {
104 this._maxNumberOfRecords = aValue; 101 this._maxNumberOfRecords = aValue;
105 }, 102 },
106 103
107 //------------------------------------------------------------------------- 104 //-------------------------------------------------------------------------
108 105
109 'errorHandler': function(anErrorString, anException) { 106 'errorHandler': function(anErrorString, anException) {
110MochiKit.Logging.logError("- User.errorHandler: " + anErrorString + " (" + anException + ")"); 107MochiKit.Logging.logError("- User.errorHandler: " + anErrorString + " (" + anException + ")");
111 }, 108 },
112 109
113 //------------------------------------------------------------------------- 110 //-------------------------------------------------------------------------
114 111
115 'connectionVersion': function() { 112 'connectionVersion': function() {
116 return this._connectionVersion; 113 return this._connectionVersion;
117 }, 114 },
118 115
119 'setConnectionVersion': function(aValue) { 116 'setConnectionVersion': function(aValue) {
120 this._connectionVersion = aValue; 117 this._connectionVersion = aValue;
diff --git a/frontend/beta/js/Clipperz/PM/DataModel/UserPreferences.js b/frontend/beta/js/Clipperz/PM/DataModel/UserPreferences.js
index dc73ce1..9e80b3a 100644
--- a/frontend/beta/js/Clipperz/PM/DataModel/UserPreferences.js
+++ b/frontend/beta/js/Clipperz/PM/DataModel/UserPreferences.js
@@ -1,120 +1,117 @@
1/* 1/*
2 2
3Copyright 2008-2011 Clipperz Srl 3Copyright 2008-2011 Clipperz Srl
4 4
5This file is part of Clipperz's Javascript Crypto Library. 5This file is part of Clipperz Community Edition.
6Javascript Crypto Library provides web developers with an extensive 6Clipperz Community Edition is an online password manager.
7and efficient set of cryptographic functions. The library aims to
8obtain maximum execution speed while preserving modularity and
9reusability.
10For further information about its features and functionalities please 7For further information about its features and functionalities please
11refer to http://www.clipperz.com 8refer to http://www.clipperz.com.
12 9
13* Javascript Crypto Library is free software: you can redistribute 10* Clipperz Community Edition is free software: you can redistribute
14 it and/or modify it under the terms of the GNU Affero General Public 11 it and/or modify it under the terms of the GNU Affero General Public
15 License as published by the Free Software Foundation, either version 12 License as published by the Free Software Foundation, either version
16 3 of the License, or (at your option) any later version. 13 3 of the License, or (at your option) any later version.
17 14
18* Javascript Crypto Library is distributed in the hope that it will 15* Clipperz Community Edition is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied 16 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 17 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details. 18 See the GNU Affero General Public License for more details.
22 19
23* You should have received a copy of the GNU Affero General Public 20* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see 21 License along with Clipperz Community Edition. If not, see
25 <http://www.gnu.org/licenses/>. 22 <http://www.gnu.org/licenses/>.
26 23
27*/ 24*/
28 25
29if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } 26if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
30if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } 27if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
31if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; } 28if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; }
32 29
33 30
34//############################################################################# 31//#############################################################################
35 32
36Clipperz.PM.DataModel.UserPreferences = function(args) { 33Clipperz.PM.DataModel.UserPreferences = function(args) {
37 args = args || {}; 34 args = args || {};
38 35
39 this._user = args['user']; delete args['user']; 36 this._user = args['user']; delete args['user'];
40 this._config = args; 37 this._config = args;
41 38
42 return this; 39 return this;
43} 40}
44 41
45Clipperz.PM.DataModel.UserPreferences.prototype = MochiKit.Base.update(null, { 42Clipperz.PM.DataModel.UserPreferences.prototype = MochiKit.Base.update(null, {
46 43
47 //------------------------------------------------------------------------- 44 //-------------------------------------------------------------------------
48 45
49 'config': function() { 46 'config': function() {
50 return this._config; 47 return this._config;
51 }, 48 },
52 49
53 //------------------------------------------------------------------------- 50 //-------------------------------------------------------------------------
54 51
55 'user': function() { 52 'user': function() {
56 return this._user; 53 return this._user;
57 }, 54 },
58 55
59 //------------------------------------------------------------------------- 56 //-------------------------------------------------------------------------
60 57
61 'updateWithData': function(someValues) { 58 'updateWithData': function(someValues) {
62 var currentLanguage; 59 var currentLanguage;
63 60
64//MochiKit.Logging.logDebug(">>> Clipperz.PM.DataModel.UserPreferences.updateWithData: " + Clipperz.Base.serializeJSON(someValues)); 61//MochiKit.Logging.logDebug(">>> Clipperz.PM.DataModel.UserPreferences.updateWithData: " + Clipperz.Base.serializeJSON(someValues));
65 currentLanguage = this.preferredLanguage(); 62 currentLanguage = this.preferredLanguage();
66 63
67 MochiKit.Base.update(this._config, someValues); 64 MochiKit.Base.update(this._config, someValues);
68 65
69 if (this.preferredLanguage() != currentLanguage) { 66 if (this.preferredLanguage() != currentLanguage) {
70 Clipperz.PM.Strings.Languages.setSelectedLanguage(this.preferredLanguage()); 67 Clipperz.PM.Strings.Languages.setSelectedLanguage(this.preferredLanguage());
71 } else { 68 } else {
72//MochiKit.Logging.logDebug("### keepping the browser selected language: " + Clipperz.PM.Strings.selectedLanguage); 69//MochiKit.Logging.logDebug("### keepping the browser selected language: " + Clipperz.PM.Strings.selectedLanguage);
73 } 70 }
74 71
75 return this; 72 return this;
76 }, 73 },
77 74
78 //------------------------------------------------------------------------- 75 //-------------------------------------------------------------------------
79 76
80 'configValue': function(aConfigName, aDefaultValue) { 77 'configValue': function(aConfigName, aDefaultValue) {
81 var result; 78 var result;
82 79
83//MochiKit.Logging.logDebug(">>> UserPreferences.configValue - config: " + Clipperz.Base.serializeJSON(this.config())); 80//MochiKit.Logging.logDebug(">>> UserPreferences.configValue - config: " + Clipperz.Base.serializeJSON(this.config()));
84 if (typeof(this.config()[aConfigName]) == 'undefined') { 81 if (typeof(this.config()[aConfigName]) == 'undefined') {
85 result = aDefaultValue; 82 result = aDefaultValue;
86 } else { 83 } else {
87 result = this.config()[aConfigName]; 84 result = this.config()[aConfigName];
88 } 85 }
89//MochiKit.Logging.logDebug("<<< UserPreferences.configValue"); 86//MochiKit.Logging.logDebug("<<< UserPreferences.configValue");
90 87
91 return result; 88 return result;
92 }, 89 },
93 90
94 'setConfigValue': function(aConfigName, aValue) { 91 'setConfigValue': function(aConfigName, aValue) {
95 var result; 92 var result;
96 93
97 if (aValue != this.configValue(aConfigName)) { 94 if (aValue != this.configValue(aConfigName)) {
98 if (aValue == null) { 95 if (aValue == null) {
99 delete this.config()[aConfigName] 96 delete this.config()[aConfigName]
100 } else { 97 } else {
101 this.config()[aConfigName] = aValue; 98 this.config()[aConfigName] = aValue;
102 } 99 }
103 100
104 Clipperz.NotificationCenter.notify(this.user(), 'updatedSection', 'preferences', true); 101 Clipperz.NotificationCenter.notify(this.user(), 'updatedSection', 'preferences', true);
105 102
106 result = true; 103 result = true;
107 } else { 104 } else {
108 result = false; 105 result = false;
109 } 106 }
110 107
111 return result; 108 return result;
112 }, 109 },
113 110
114 //------------------------------------------------------------------------- 111 //-------------------------------------------------------------------------
115 112
116 'useSafeEditMode': function() { 113 'useSafeEditMode': function() {
117 return this.configValue('useSafeEditMode', true); 114 return this.configValue('useSafeEditMode', true);
118 }, 115 },
119 116
120 'setUseSafeEditMode': function(aValue) { 117 'setUseSafeEditMode': function(aValue) {