summaryrefslogtreecommitdiff
path: root/frontend/beta/js/Clipperz/PM/DataModel
Side-by-side diff
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.js22
-rw-r--r--frontend/beta/js/Clipperz/PM/DataModel/DirectLoginBinding.js22
-rw-r--r--frontend/beta/js/Clipperz/PM/DataModel/DirectLoginInput.js22
-rw-r--r--frontend/beta/js/Clipperz/PM/DataModel/DirectLoginReference.js22
-rw-r--r--frontend/beta/js/Clipperz/PM/DataModel/Header.js22
-rw-r--r--frontend/beta/js/Clipperz/PM/DataModel/OneTimePassword.js22
-rw-r--r--frontend/beta/js/Clipperz/PM/DataModel/OneTimePasswordManager.js22
-rw-r--r--frontend/beta/js/Clipperz/PM/DataModel/Record.js22
-rw-r--r--frontend/beta/js/Clipperz/PM/DataModel/RecordField.js22
-rw-r--r--frontend/beta/js/Clipperz/PM/DataModel/RecordVersion.js22
-rw-r--r--frontend/beta/js/Clipperz/PM/DataModel/Statistics.js22
-rw-r--r--frontend/beta/js/Clipperz/PM/DataModel/User.js22
-rw-r--r--frontend/beta/js/Clipperz/PM/DataModel/UserPreferences.js22
13 files changed, 130 insertions, 156 deletions
diff --git a/frontend/beta/js/Clipperz/PM/DataModel/DirectLogin.js b/frontend/beta/js/Clipperz/PM/DataModel/DirectLogin.js
index aee5703..c0cfa3c 100644
--- a/frontend/beta/js/Clipperz/PM/DataModel/DirectLogin.js
+++ b/frontend/beta/js/Clipperz/PM/DataModel/DirectLogin.js
@@ -1,214 +1,212 @@
/*
-Copyright 2008-2011 Clipperz Srl
+Copyright 2008-2013 Clipperz Srl
-This file is part of Clipperz Community Edition.
-Clipperz Community Edition is an online password manager.
+This file is part of Clipperz, the online password manager.
For further information about its features and functionalities please
refer to http://www.clipperz.com.
-* Clipperz Community Edition is free software: you can redistribute
- it and/or modify it under the terms of the GNU Affero General Public
- License as published by the Free Software Foundation, either version
- 3 of the License, or (at your option) any later version.
+* Clipperz is free software: you can redistribute it and/or modify it
+ under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
-* Clipperz Community Edition is distributed in the hope that it will
- be useful, but WITHOUT ANY WARRANTY; without even the implied
- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+* Clipperz is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Affero General Public License for more details.
* You should have received a copy of the GNU Affero General Public
- License along with Clipperz Community Edition. If not, see
- <http://www.gnu.org/licenses/>.
+ License along with Clipperz. If not, see http://www.gnu.org/licenses/.
*/
if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; }
//#############################################################################
Clipperz.PM.DataModel.DirectLogin = function(args) {
//MochiKit.Logging.logDebug(">>> new Clipperz.PM.DataModel.DirectLogin");
//console.log(">>> new Clipperz.PM.DataModel.DirectLogin - args: %o", args);
//console.log("--- formData: %s", Clipperz.Base.serializeJSON(args.formData));
args = args || {};
//MochiKit.Logging.logDebug("--- new Clipperz.PM.DataModel.DirectLogin - args: " + Clipperz.Base.serializeJSON(MochiKit.Base.keys(args)));
this._record = args.record || null;
this._label = args.label || "unnamed record"
this._reference = args.reference || Clipperz.PM.Crypto.randomKey();
this._favicon = args.favicon || null;
this._bookmarkletVersion = args.bookmarkletVersion || "0.1";
this._directLoginInputs = null;
this._formValues = args.formValues || {};
this.setFormData(args.formData || null);
//console.log("=== formData: %o", this.formData());
if (args.legacyBindingData == null) {
this.setBindingData(args.bindingData || null);
} else {
this.setLegacyBindingData(args.legacyBindingData);
}
this._fixedFavicon = null;
// this._formValues = args.formValues || (this.hasValuesToSet() ? {} : null);
//MochiKit.Logging.logDebug("<<< new Clipperz.PM.DataModel.DirectLogin");
return this;
}
Clipperz.PM.DataModel.DirectLogin.prototype = MochiKit.Base.update(null, {
'remove': function() {
this.record().removeDirectLogin(this);
},
//-------------------------------------------------------------------------
'record': function() {
return this._record;
},
//-------------------------------------------------------------------------
'user': function() {
return this.record().user();
},
//-------------------------------------------------------------------------
'reference': function() {
return this._reference;
},
//-------------------------------------------------------------------------
'label': function() {
return this._label;
},
'setLabel': function(aValue) {
this._label = aValue;
},
//-------------------------------------------------------------------------
'favicon': function() {
if (this._favicon == null) {
var actionUrl;
var hostname;
actionUrl = this.formData()['attributes']['action'];
hostname = actionUrl.replace(/^https?:\/\/([^\/]*)\/.*/, '$1');
this._favicon = "http://" + hostname + "/favicon.ico";
}
return this._favicon;
},
//-------------------------------------------------------------------------
'fixedFavicon': function() {
var result;
if (this._fixedFavicon == null) {
result = this.favicon();
if (Clipperz_IEisBroken) {
if (this.user().preferences().disableUnsecureFaviconLoadingForIE()) {
if (result.indexOf('https://') != 0) {
result = Clipperz.PM.Strings['defaultFaviconUrl_IE'];
this.setFixedFavicon(result);
}
}
}
} else {
result = this._fixedFavicon;
}
return result;
},
'setFixedFavicon': function(aValue) {
this._fixedFavicon = aValue;
},
//-------------------------------------------------------------------------
'bookmarkletVersion': function() {
return this._bookmarkletVersion;
},
'setBookmarkletVersion': function(aValue) {
this._bookmarkletVersion = aValue;
},
//-------------------------------------------------------------------------
'formData': function() {
return this._formData;
},
'setFormData': function(aValue) {
var formData;
//MochiKit.Logging.logDebug(">>> DirectLogin.setFormData - " + Clipperz.Base.serializeJSON(aValue));
switch (this.bookmarkletVersion()) {
case "0.2":
formData = aValue;
break;
case "0.1":
//MochiKit.Logging.logDebug("--- DirectLogin.setFormData - fixing form data from bookmarklet version 0.1");
formData = this.fixFormDataFromBookmarkletVersion_0_1(aValue);
break;
}
this._formData = aValue;
this.setBookmarkletVersion("0.2");
//MochiKit.Logging.logDebug("--- DirectLogin.setFormData - formData: " + Clipperz.Base.serializeJSON(formData));
if (formData != null) {
var i,c;
this._directLoginInputs = [];
c = formData['inputs'].length;
for (i=0; i<c; i++) {
var directLoginInput;
directLoginInput = new Clipperz.PM.DataModel.DirectLoginInput(this, formData['inputs'][i]);
this._directLoginInputs.push(directLoginInput);
}
}
//MochiKit.Logging.logDebug("<<< DirectLogin.setFormData");
},
'fixFormDataFromBookmarkletVersion_0_1': function(aValue) {
//{"type":"radio", "name":"action", "value":"new-user", "checked":false }, { "type":"radio", "name":"action", "value":"sign-in", "checked":true }
// ||
// \ /
// \/
//{"name":"dominio", "type":"radio", "options":[{"value":"@alice.it", "checked":true}, {"value":"@tin.it", "checked":false}, {"value":"@virgilio.it", "checked":false}, {"value":"@tim.it", "checked":false}]}
var result;
var inputs;
var updatedInputs;
var radios;
//MochiKit.Logging.logDebug(">>> DirectLogin.fixFormDataFromBookmarkletVersion_0_1");
result = aValue;
inputs = aValue['inputs'];
updatedInputs = MochiKit.Base.filter(function(anInput) {
var result;
var type;
type = anInput['type'] || 'text';
result = type.toLowerCase() != 'radio';
return result;
}, inputs);
diff --git a/frontend/beta/js/Clipperz/PM/DataModel/DirectLoginBinding.js b/frontend/beta/js/Clipperz/PM/DataModel/DirectLoginBinding.js
index 7f09bff..cef41af 100644
--- a/frontend/beta/js/Clipperz/PM/DataModel/DirectLoginBinding.js
+++ b/frontend/beta/js/Clipperz/PM/DataModel/DirectLoginBinding.js
@@ -1,110 +1,108 @@
/*
-Copyright 2008-2011 Clipperz Srl
+Copyright 2008-2013 Clipperz Srl
-This file is part of Clipperz Community Edition.
-Clipperz Community Edition is an online password manager.
+This file is part of Clipperz, the online password manager.
For further information about its features and functionalities please
refer to http://www.clipperz.com.
-* Clipperz Community Edition is free software: you can redistribute
- it and/or modify it under the terms of the GNU Affero General Public
- License as published by the Free Software Foundation, either version
- 3 of the License, or (at your option) any later version.
+* Clipperz is free software: you can redistribute it and/or modify it
+ under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
-* Clipperz Community Edition is distributed in the hope that it will
- be useful, but WITHOUT ANY WARRANTY; without even the implied
- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+* Clipperz is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Affero General Public License for more details.
* You should have received a copy of the GNU Affero General Public
- License along with Clipperz Community Edition. If not, see
- <http://www.gnu.org/licenses/>.
+ License along with Clipperz. If not, see http://www.gnu.org/licenses/.
*/
if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; }
//#############################################################################
Clipperz.PM.DataModel.DirectLoginBinding = function(aDirectLogin, aKey, args) {
//MochiKit.Logging.logDebug(">>> new DirectLoginBinding")
args = args || {};
//MochiKit.Logging.logDebug("--- new DirectLoginBinding - args: " + Clipperz.Base.serializeJSON(args));
this._directLogin = aDirectLogin || args.directLogin || null;
this._key = aKey;
this._fieldKey = args.fieldKey || null;
this._fieldName = args.fieldName || null;
//MochiKit.Logging.logDebug("<<< new DirectLoginBinding")
return this;
}
Clipperz.PM.DataModel.DirectLoginBinding.prototype = MochiKit.Base.update(null, {
'directLogin': function() {
return this._directLogin;
},
//-------------------------------------------------------------------------
'key': function() {
return this._key;
},
//-------------------------------------------------------------------------
'fieldKey': function() {
//MochiKit.Logging.logDebug("=== Clipperz.PM.DataModel.DirectLoginBinding.fieldKey");
//MochiKit.Logging.logDebug("=== Clipperz.PM.DataModel.DirectLoginBinding.fieldKey - " + this._fieldKey);
return this._fieldKey;
},
'setFieldKey': function(aValue) {
this._fieldKey = aValue;
},
'fieldName': function() {
return this._fieldName;
},
//-------------------------------------------------------------------------
'field': function() {
var result;
//MochiKit.Logging.logDebug(">>> Clipperz.PM.DataModel.DirectLoginBinding.field")
//MochiKit.Logging.logDebug("--- Clipperz.PM.DataModel.DirectLoginBinding.field - 1 - this.fieldKey(): " + this.fieldKey());
//MochiKit.Logging.logDebug("--- Clipperz.PM.DataModel.DirectLoginBinding.field - 2 - this.fieldName(): " + this.fieldName());
if (this.fieldKey() != null) {
result = this.directLogin().record().currentVersion().fields()[this.fieldKey()];
//MochiKit.Logging.logDebug("--- Clipperz.PM.DataModel.DirectLoginBinding.field - 3 - result: " + result);
} else if (this.fieldName() != null) {
result = this.directLogin().record().currentVersion().fieldWithName(this.fieldName());
//MochiKit.Logging.logDebug("--- Clipperz.PM.DataModel.DirectLoginBinding.field - 4 - result: " + result);
this.setFieldKey(result.key());
} else {
result = null;
}
//MochiKit.Logging.logDebug("<<< Clipperz.PM.DataModel.DirectLoginBinding.field")
return result;
},
//-------------------------------------------------------------------------
'serializedData': function() {
return this.fieldKey();
},
//-------------------------------------------------------------------------
__syntaxFix__: "syntax fix"
});
diff --git a/frontend/beta/js/Clipperz/PM/DataModel/DirectLoginInput.js b/frontend/beta/js/Clipperz/PM/DataModel/DirectLoginInput.js
index 0e2b7ad..e5e9ad5 100644
--- a/frontend/beta/js/Clipperz/PM/DataModel/DirectLoginInput.js
+++ b/frontend/beta/js/Clipperz/PM/DataModel/DirectLoginInput.js
@@ -1,214 +1,212 @@
/*
-Copyright 2008-2011 Clipperz Srl
+Copyright 2008-2013 Clipperz Srl
-This file is part of Clipperz Community Edition.
-Clipperz Community Edition is an online password manager.
+This file is part of Clipperz, the online password manager.
For further information about its features and functionalities please
refer to http://www.clipperz.com.
-* Clipperz Community Edition is free software: you can redistribute
- it and/or modify it under the terms of the GNU Affero General Public
- License as published by the Free Software Foundation, either version
- 3 of the License, or (at your option) any later version.
+* Clipperz is free software: you can redistribute it and/or modify it
+ under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
-* Clipperz Community Edition is distributed in the hope that it will
- be useful, but WITHOUT ANY WARRANTY; without even the implied
- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+* Clipperz is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Affero General Public License for more details.
* You should have received a copy of the GNU Affero General Public
- License along with Clipperz Community Edition. If not, see
- <http://www.gnu.org/licenses/>.
+ License along with Clipperz. If not, see http://www.gnu.org/licenses/.
*/
if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; }
//#############################################################################
Clipperz.PM.DataModel.DirectLoginInput = function(aDirectLogin, args) {
args = args || {};
//console.log(">>> new DirectLoginInput - args: %o" + args);
this._directLogin = aDirectLogin;
this._args = args;
return this;
}
Clipperz.PM.DataModel.DirectLoginInput.prototype = MochiKit.Base.update(null, {
'directLogin': function() {
return this._directLogin;
},
//-------------------------------------------------------------------------
'args': function() {
return this._args;
},
//-------------------------------------------------------------------------
'name': function() {
return this.args()['name'];
},
//-------------------------------------------------------------------------
'type': function() {
var result;
result = this.args()['type'];
if (result != null) {
result = result.toLowerCase();
}
return result;
},
//-------------------------------------------------------------------------
'value': function() {
return this.args()['value'];
},
//-------------------------------------------------------------------------
'formConfiguration': function() {
var result;
//MochiKit.Logging.logDebug(">>> DirectLoginInput.formConfiguration - " + this.name());
if (this.shouldSetValue()) {
//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 1");
switch (this.type()) {
case 'select':
var currentValue;
var options;
//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 2");
currentValue = this.directLogin().formValues()[this.name()];
//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 2.1");
options = this.args()['options'];
//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 2.2");
result = MochiKit.DOM.SELECT({name:this.name()},
MochiKit.Base.map(function(anOption) {
var options;
//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 2.3");
// TODO: remove the value: field and replace it with element.dom.value = <some value>
options = {value:anOption['value']};
//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 2.4");
if (currentValue == anOption['value']) {
//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 2.5");
options.selected = true;
//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 2.6");
}
//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 2.7");
return MochiKit.DOM.OPTION(options, anOption['label'])
}, options)
)
//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 2.8");
break;
case 'checkbox':
var options;
//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 3");
options = {type:'checkbox', name: this.name()};
if (this.directLogin().formValues()[this.name()] == true) {
options['checked'] = true;
};
result = MochiKit.DOM.INPUT(options, null);
break;
case 'radio':
var currentName;
var currentValue;
var options;
//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 4");
currentName = this.name();
//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 4.1");
currentValue = this.directLogin().formValues()[this.name()];
//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 4.2");
options = this.args()['options'];
//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 4.3");
result = MochiKit.DOM.DIV(null,
MochiKit.Base.map(function(anOption) {
var options;
var isChecked;
var inputNode;
var divNode;
//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 4.4");
// TODO: remove the value: field and replace it with element.dom.value = <some value>
options = {type:'radio', name:currentName, value:anOption['value']}
isChecked = (currentValue == anOption['value']);
//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 4.5");
if (isChecked) {
//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 4.6");
options.checked = true;
//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 4.7");
}
//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 4.8 - options: " + Clipperz.Base.serializeJSON(options));
//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 4.8 - value: " + anOption['value']);
if (Clipperz_IEisBroken == true) {
var checkedValue;
//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 4.8.1");
checkedValue = (isChecked ? " CHECKED" : "");
//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 4.8.2");
inputNode = MochiKit.DOM.currentDocument().createElement("<INPUT TYPE='RADIO' NAME='" + currentName + "' VALUE='" + anOption['value'] + "'" + checkedValue + ">");
//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 4.8.3");
} else {
//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 4.8.4");
inputNode = MochiKit.DOM.INPUT(options, anOption['value']);
//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 4.8.5");
}
//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 4.9");
divNode = MochiKit.DOM.DIV(null, inputNode);
//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 4.10");
return divNode;
// return MochiKit.DOM.DIV(null, MochiKit.DOM.INPUT(options, anOption['value']));
}, options)
);
//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 4.9");
break;
}
} else {
var binding;
//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 5");
binding = this.directLogin().bindings()[this.name()];
//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 6");
// TODO: remove the value: field and replace it with element.dom.value = <some value>
result = MochiKit.DOM.INPUT({
type:((this.type() != 'password') ? this.type() : 'text'),
// type:(((this.type() != 'password') && (this.type() != 'submit')) ? this.type() : 'text'),
name:this.name(),
value:((binding != null)? binding.field().value() : this.value())
}, null);
//MochiKit.Logging.logDebug("--- DirectLoginInput.formConfiguration - 7");
}
//MochiKit.Logging.logDebug("<<< DirectLoginInput.formConfiguration: ");
return result;
},
//-------------------------------------------------------------------------
'shouldSetValue': function() {
var type;
var result;
//MochiKit.Logging.logDebug(">>> DirectLoginInput.shouldSetValue");
type = this.type();
result = ((type == 'checkbox') || (type == 'radio') || (type == 'select'));
diff --git a/frontend/beta/js/Clipperz/PM/DataModel/DirectLoginReference.js b/frontend/beta/js/Clipperz/PM/DataModel/DirectLoginReference.js
index 2be7d58..236d7c9 100644
--- a/frontend/beta/js/Clipperz/PM/DataModel/DirectLoginReference.js
+++ b/frontend/beta/js/Clipperz/PM/DataModel/DirectLoginReference.js
@@ -1,189 +1,187 @@
/*
-Copyright 2008-2011 Clipperz Srl
+Copyright 2008-2013 Clipperz Srl
-This file is part of Clipperz Community Edition.
-Clipperz Community Edition is an online password manager.
+This file is part of Clipperz, the online password manager.
For further information about its features and functionalities please
refer to http://www.clipperz.com.
-* Clipperz Community Edition is free software: you can redistribute
- it and/or modify it under the terms of the GNU Affero General Public
- License as published by the Free Software Foundation, either version
- 3 of the License, or (at your option) any later version.
+* Clipperz is free software: you can redistribute it and/or modify it
+ under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
-* Clipperz Community Edition is distributed in the hope that it will
- be useful, but WITHOUT ANY WARRANTY; without even the implied
- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+* Clipperz is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Affero General Public License for more details.
* You should have received a copy of the GNU Affero General Public
- License along with Clipperz Community Edition. If not, see
- <http://www.gnu.org/licenses/>.
+ License along with Clipperz. If not, see http://www.gnu.org/licenses/.
*/
if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; }
//#############################################################################
Clipperz.PM.DataModel.DirectLoginReference = function(args) {
args = args || {};
//MochiKit.Logging.logDebug(">>> new DirectLoginReference: " + Clipperz.Base.serializeJSON(MochiKit.Base.keys(args)));
//MochiKit.Logging.logDebug(">>> new DirectLoginReference - record: " + args.record);
this._user = args.user;
if (args.directLogin != null) {
this._reference = args.directLogin.reference();
this._recordReference = args.directLogin.record().reference();
this._label = args.directLogin.label();
this._favicon = args.directLogin.favicon() || null;
this._directLogin = args.directLogin;
this._record = args.directLogin.record();
} else {
this._reference = args.reference;
this._recordReference = args.record;
this._label = args.label;
this._favicon = args.favicon || null;
this._directLogin = null;
this._record = null;
}
this._fixedFavicon = null;
return this;
}
Clipperz.PM.DataModel.DirectLoginReference.prototype = MochiKit.Base.update(null, {
'user': function() {
return this._user;
},
//-------------------------------------------------------------------------
'reference': function() {
return this._reference;
},
//-------------------------------------------------------------------------
'synchronizeValues': function(aDirectLogin) {
this._label = aDirectLogin.label();
this._favicon = aDirectLogin.favicon();
},
//-------------------------------------------------------------------------
'label': function() {
return this._label;
},
//-------------------------------------------------------------------------
'recordReference': function() {
return this._recordReference;
},
//-------------------------------------------------------------------------
'record': function() {
//MochiKit.Logging.logDebug(">>> DirectLoginReference.record");
if (this._record == null) {
this._record = this.user().records()[this.recordReference()];
}
//MochiKit.Logging.logDebug("<<< DirectLoginReference.record");
return this._record;
},
//-------------------------------------------------------------------------
'favicon': function() {
return this._favicon;
},
//-------------------------------------------------------------------------
'fixedFavicon': function() {
var result;
if (this._fixedFavicon == null) {
result = this.favicon();
if (Clipperz_IEisBroken && (this.user().preferences().disableUnsecureFaviconLoadingForIE()) && (result.indexOf('https://') != 0)) {
result = Clipperz.PM.Strings['defaultFaviconUrl_IE'];
this.setFixedFavicon(result);
}
} else {
result = this._fixedFavicon;
}
return result;
},
'setFixedFavicon': function(aValue) {
this._fixedFavicon = aValue;
},
//-------------------------------------------------------------------------
'setupJumpPageWindow': function(aWindow) {
//MochiKit.Logging.logDebug(">>> DirectLoginReference.setupJumpPageWindow - " + aWindow);
try {
MochiKit.DOM.withWindow(aWindow, MochiKit.Base.bind(function() {
MochiKit.DOM.appendChildNodes(MochiKit.DOM.currentDocument().body,
MochiKit.DOM.H1(null, "Loading " + this.label())
);
}, this));
} catch(e) {
MochiKit.Logging.logDebug("EXCEPTION: " + e);
}
//MochiKit.Logging.logDebug("<<< DirectLoginReference.setupJumpPageWindow");
},
//-------------------------------------------------------------------------
'deferredDirectLogin': function() {
var deferredResult;
//MochiKit.Logging.logDebug(">>> DirectLoginReference.deferredDirectLogin - " + this);
deferredResult = new MochiKit.Async.Deferred();
//MochiKit.Logging.logDebug("--- DirectLoginReference.deferredDirectLogin - 1");
deferredResult.addCallback(MochiKit.Base.method(this.record(), 'deferredData'));
//MochiKit.Logging.logDebug("--- DirectLoginReference.deferredDirectLogin - 2");
deferredResult.addCallback(function(aRecord, aDirectLoginReference) {
return aRecord.directLogins()[aDirectLoginReference];
}, this.record(), this.reference());
//MochiKit.Logging.logDebug("--- DirectLoginReference.deferredDirectLogin - 3");
deferredResult.callback();
//MochiKit.Logging.logDebug("<<< DirectLoginReference.deferredDirectLogin");
return deferredResult;
},
//-------------------------------------------------------------------------
'handleMissingFaviconImage': function(anEvent) {
//MochiKit.Logging.logDebug(">>> DirectLoginReference.handleMissingFaviconImage");
anEvent.stop();
MochiKit.Signal.disconnectAll(anEvent.src());
this.setFixedFavicon(Clipperz.PM.Strings['defaultFaviconUrl']);
//MochiKit.Logging.logDebug("--- DirectLoginReference.handleMissingFaviconImage - fixedFavicon: " + this.fixedFavicon());
//MochiKit.Logging.logDebug("--- DirectLoginReference.handleMissingFaviconImage - anEvent.src().src: " + anEvent.src().src);
// MochiKit.DOM.swapDOM(anEvent.src(), MochiKit.DOM.IMG({src:'this.fixedFavicon()'}));
anEvent.src().src = this.fixedFavicon();
//MochiKit.Logging.logDebug("<<< DirectLoginReference.handleMissingFaviconImage");
},
//-------------------------------------------------------------------------
__syntaxFix__: "syntax fix"
});
diff --git a/frontend/beta/js/Clipperz/PM/DataModel/Header.js b/frontend/beta/js/Clipperz/PM/DataModel/Header.js
index c780855..908d9f4 100644
--- a/frontend/beta/js/Clipperz/PM/DataModel/Header.js
+++ b/frontend/beta/js/Clipperz/PM/DataModel/Header.js
@@ -1,214 +1,212 @@
/*
-Copyright 2008-2011 Clipperz Srl
+Copyright 2008-2013 Clipperz Srl
-This file is part of Clipperz Community Edition.
-Clipperz Community Edition is an online password manager.
+This file is part of Clipperz, the online password manager.
For further information about its features and functionalities please
refer to http://www.clipperz.com.
-* Clipperz Community Edition is free software: you can redistribute
- it and/or modify it under the terms of the GNU Affero General Public
- License as published by the Free Software Foundation, either version
- 3 of the License, or (at your option) any later version.
+* Clipperz is free software: you can redistribute it and/or modify it
+ under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
-* Clipperz Community Edition is distributed in the hope that it will
- be useful, but WITHOUT ANY WARRANTY; without even the implied
- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+* Clipperz is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Affero General Public License for more details.
* You should have received a copy of the GNU Affero General Public
- License along with Clipperz Community Edition. If not, see
- <http://www.gnu.org/licenses/>.
+ License along with Clipperz. If not, see http://www.gnu.org/licenses/.
*/
if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; }
//#############################################################################
Clipperz.PM.DataModel.Header = function(args) {
args = args || {};
this._user = args.user;
this._serverData = null;
this._serverDataVersion = null;
this._jsonEvaledServerData = null;
this._decryptedLegacyServerData = null;
this._isDecryptingLegacyServerData = false;
this._decryptingLegacyServerDataPendingQueue = [];
this.resetUpdatedSections();
this._shouldLoadSections = {};
Clipperz.NotificationCenter.register(this.user(), 'updatedSection', this, 'updatedSectionHandler');
return this;
}
Clipperz.PM.DataModel.Header.prototype = MochiKit.Base.update(null, {
//-------------------------------------------------------------------------
'user': function() {
return this._user;
},
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
'updatedSections': function() {
return this._updatedSections;
},
'markSectionAsUpdated': function(aSectionName) {
this.updatedSections().push(aSectionName);
},
'resetUpdatedSections': function() {
this._updatedSections = []
},
'hasSectionBeenUpdated': function(aSectionName) {
return (this.updatedSections().join().indexOf(aSectionName) != -1);
},
'cachedServerDataSection': function(aSectionName) {
return (this.hasSectionBeenUpdated(aSectionName)) ? {} : this.jsonEvaledServerData()[aSectionName];
},
'updateAllSections': function() {
this.resetUpdatedSections();
this.markSectionAsUpdated('records');
this.markSectionAsUpdated('directLogins');
this.markSectionAsUpdated('preferences');
this.markSectionAsUpdated('oneTimePasswords');
return MochiKit.Async.succeed(this);
},
'updatedSectionHandler': function(anEvent) {
this.markSectionAsUpdated(anEvent.parameters());
},
//-------------------------------------------------------------------------
'getObjectKeyIndex': function(anObject) {
var result;
var itemReference;
var index;
result = {};
index = 0;
for (itemReference in anObject) {
result[itemReference] = index.toString();
index ++;
}
return result;
},
//-------------------------------------------------------------------------
'serializedDataWithRecordAndDirectLoginIndexes': function(aRecordIndexes, aDirectLoginIndexs) {
var result;
var records;
var recordReference;
//MochiKit.Logging.logDebug(">>> Header.serializedData");
result = {
'records': {},
'directLogins': {}
};
records = this.user().records();
for (recordReference in records) {
result['records'][aRecordIndexes[recordReference]] = this.user().records()[recordReference].headerData();
}
for (directLoginReference in this.user().directLoginReferences()) {
var currentDirectLogin;
var directLoginData;
currentDirectLogin = this.user().directLoginReferences()[directLoginReference];
if (aRecordIndexes[currentDirectLogin.recordReference()] != null) {
directLoginData = {
// reference: currentDirectLogin.reference(),
record: aRecordIndexes[currentDirectLogin.recordReference()].toString(),
label: currentDirectLogin.label(),
favicon: currentDirectLogin.favicon() || ""
}
result['directLogins'][aDirectLoginIndexs[directLoginReference]] = directLoginData;
}
}
//MochiKit.Logging.logDebug("<<< Header.serializedData - result: " + Clipperz.Base.serializeJSON(result));
//MochiKit.Logging.logDebug("<<< Header.serializedData");
return result;
},
//-------------------------------------------------------------------------
'encryptedData': function() {
var deferredResult;
var recordIndex;
var directLoginIndex;
var serializedData;
var result;
//MochiKit.Logging.logDebug(">>> [" + (new Date()).valueOf() + "] Header.encryptedData");
//MochiKit.Logging.logDebug("### Header.encryptedData - " + Clipperz.Base.serializeJSON(this.updatedSections()));
result = {
'records': this.cachedServerDataSection('records'),
'directLogins': this.cachedServerDataSection('directLogins'),
'preferences': this.cachedServerDataSection('preferences'),
'oneTimePasswords': this.cachedServerDataSection('oneTimePasswords'),
'version': '0.1'
};
if (this.hasSectionBeenUpdated('records')) {
recordIndex = this.getObjectKeyIndex(this.user().records());
result['records']['index'] = recordIndex;
} else {
recordIndex = result['records']['index'];
}
if (this.hasSectionBeenUpdated('directLogins')) {
directLoginIndex = this.getObjectKeyIndex(this.user().directLoginReferences());
result['directLogins']['index'] = directLoginIndex;
} else {
directLoginIndex = result['directLogins']['index'];
}
if (this.hasSectionBeenUpdated('records') || this.hasSectionBeenUpdated('directLogins')) {
serializedData = this.serializedDataWithRecordAndDirectLoginIndexes(recordIndex, directLoginIndex);
}
deferredResult = new MochiKit.Async.Deferred();
//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Header.encryptedData - 1: " + res); return res;});
if (this.hasSectionBeenUpdated('records')) {
//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Header.encryptedData - 1.1: " + res); return res;});
deferredResult.addCallback(function(anHeader, aResult, aSerializedData, aValue) {
return Clipperz.PM.Crypto.deferredEncryptWithCurrentVersion(anHeader.user().passphrase(), aSerializedData['records']);
}, this, result, serializedData);
//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Header.encryptedData - 1.2: " + res); return res;});
deferredResult.addCallback(function(anHeader, aResult, aValue) {
aResult['records']['data'] = aValue;
}, this, result);
diff --git a/frontend/beta/js/Clipperz/PM/DataModel/OneTimePassword.js b/frontend/beta/js/Clipperz/PM/DataModel/OneTimePassword.js
index 88f383a..3f611b4 100644
--- a/frontend/beta/js/Clipperz/PM/DataModel/OneTimePassword.js
+++ b/frontend/beta/js/Clipperz/PM/DataModel/OneTimePassword.js
@@ -1,214 +1,212 @@
/*
-Copyright 2008-2011 Clipperz Srl
+Copyright 2008-2013 Clipperz Srl
-This file is part of Clipperz Community Edition.
-Clipperz Community Edition is an online password manager.
+This file is part of Clipperz, the online password manager.
For further information about its features and functionalities please
refer to http://www.clipperz.com.
-* Clipperz Community Edition is free software: you can redistribute
- it and/or modify it under the terms of the GNU Affero General Public
- License as published by the Free Software Foundation, either version
- 3 of the License, or (at your option) any later version.
+* Clipperz is free software: you can redistribute it and/or modify it
+ under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
-* Clipperz Community Edition is distributed in the hope that it will
- be useful, but WITHOUT ANY WARRANTY; without even the implied
- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+* Clipperz is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Affero General Public License for more details.
* You should have received a copy of the GNU Affero General Public
- License along with Clipperz Community Edition. If not, see
- <http://www.gnu.org/licenses/>.
+ License along with Clipperz. If not, see http://www.gnu.org/licenses/.
*/
if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; }
//#############################################################################
Clipperz.PM.DataModel.OneTimePassword = function(args) {
args = args || {};
//console.log("new OneTimePassword", args);
//MochiKit.Logging.logDebug("---");
this._user = args['user'];
this._password = args['password'];
this._passwordValue = Clipperz.PM.DataModel.OneTimePassword.normalizedOneTimePassword(args['password']);
this._reference = args['reference'] || Clipperz.PM.Crypto.randomKey();
this._creationDate = args['created'] ? Clipperz.PM.Date.parseDateWithUTCFormat(args['created']) : new Date();
this._usageDate = args['used'] ? Clipperz.PM.Date.parseDateWithUTCFormat(args['used']) : null;
this._status = args['status'] || 'ACTIVE';
this._connectionInfo = null;
this._key = null;
this._keyChecksum = null;
return this;
}
Clipperz.PM.DataModel.OneTimePassword.prototype = MochiKit.Base.update(null, {
'toString': function() {
return "Clipperz.PM.DataModel.OneTimePassword";
},
//-------------------------------------------------------------------------
'user': function() {
return this._user;
},
//-------------------------------------------------------------------------
'password': function() {
return this._password;
},
//-------------------------------------------------------------------------
'passwordValue': function() {
return this._passwordValue;
},
//-------------------------------------------------------------------------
'creationDate': function() {
return this._creationDate;
},
//-------------------------------------------------------------------------
'reference': function() {
return this._reference;
},
//-------------------------------------------------------------------------
'key': function() {
if (this._key == null) {
this._key = Clipperz.PM.DataModel.OneTimePassword.computeKeyWithUsernameAndPassword(this.user().username(), this.passwordValue());
}
return this._key;
},
//-------------------------------------------------------------------------
'keyChecksum': function() {
if (this._keyChecksum == null) {
this._keyChecksum = Clipperz.PM.DataModel.OneTimePassword.computeKeyChecksumWithUsernameAndPassword(this.user().username(), this.passwordValue());
}
return this._keyChecksum;
},
//-------------------------------------------------------------------------
'status': function() {
return this._status;
},
'setStatus': function(aValue) {
this._status = aValue;
},
//-------------------------------------------------------------------------
'serializedData': function() {
var result;
result = {
'password': this.password(),
'created': this.creationDate() ? Clipperz.PM.Date.formatDateWithUTCFormat(this.creationDate()) : null,
'used': this.usageDate() ? Clipperz.PM.Date.formatDateWithUTCFormat(this.usageDate()) : null,
'status': this.status()
};
return result;
},
//-------------------------------------------------------------------------
'packedPassphrase': function() {
var result;
var packedPassphrase;
var encodedPassphrase;
var prefixPadding;
var suffixPadding;
var getRandomBytes;
getRandomBytes = MochiKit.Base.method(Clipperz.Crypto.PRNG.defaultRandomGenerator(), 'getRandomBytes');
encodedPassphrase = new Clipperz.ByteArray(this.user().passphrase()).toBase64String();
//MochiKit.Logging.logDebug("--- encodedPassphrase.length: " + encodedPassphrase.length);
prefixPadding = getRandomBytes(getRandomBytes(1).byteAtIndex(0)).toBase64String();
//MochiKit.Logging.logDebug("--- prefixPadding.length: " + prefixPadding.length);
suffixPadding = getRandomBytes((500 - prefixPadding.length - encodedPassphrase.length) * 6 / 8).toBase64String();
//MochiKit.Logging.logDebug("--- suffixPadding.length: " + suffixPadding.length);
//MochiKit.Logging.logDebug("--- total.length: " + (prefixPadding.length + encodedPassphrase.length + suffixPadding.length));
packedPassphrase = {
'prefix': prefixPadding,
'passphrase': encodedPassphrase,
'suffix': suffixPadding
};
// result = Clipperz.Base.serializeJSON(packedPassphrase);
result = packedPassphrase;
//MochiKit.Logging.logDebug("===== OTP packedPassprase: [" + result.length + "]" + result);
//MochiKit.Logging.logDebug("<<< OneTimePassword.packedPassphrase");
return result;
},
//-------------------------------------------------------------------------
'encryptedPackedPassphrase': function() {
return Clipperz.PM.Crypto.deferredEncryptWithCurrentVersion(this.passwordValue(), this.packedPassphrase())
},
//-------------------------------------------------------------------------
'encryptedData': function() {
var deferredResult;
var result;
//MochiKit.Logging.logDebug(">>> OneTimePassword.encryptedData");
//MochiKit.Logging.logDebug("--- OneTimePassword.encryptedData - id: " + this.reference());
result = {
'reference': this.reference(),
'key': this.key(),
'keyChecksum': this.keyChecksum(),
'data': "",
'version': Clipperz.PM.Crypto.encryptingFunctions.currentVersion
}
//MochiKit.Logging.logDebug("--- OneTimePassword.encryptedData - 2: " + Clipperz.Base.serializeJSON(result));
deferredResult = new MochiKit.Async.Deferred();
//MochiKit.Logging.logDebug("--- OneTimePassword.encryptedData - 3");
//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("OneTimePassword.encryptedData - 1: " + res); return res;});
//# deferredResult.addCallback(Clipperz.PM.Crypto.deferredEncryptWithCurrentVersion, this.passwordValue(), this.packedPassphrase());
deferredResult.addCallback(MochiKit.Base.method(this, 'encryptedPackedPassphrase'));
//MochiKit.Logging.logDebug("--- OneTimePassword.encryptedData - 4");
//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("OneTimePassword.encryptedData - 2: [" + res.length + "]" + res); return res;});
deferredResult.addCallback(function(aResult, res) {
aResult['data'] = res;
return aResult;
}, result);
//MochiKit.Logging.logDebug("--- OneTimePassword.encryptedData - 5");
//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("OneTimePassword.encryptedData - 3: " + Clipperz.Base.serializeJSON(res)); return res;});
deferredResult.callback();
//MochiKit.Logging.logDebug("--- OneTimePassword.encryptedData - 6");
return deferredResult;
},
//-------------------------------------------------------------------------
'saveChanges': function() {
var deferredResult;
var result;
diff --git a/frontend/beta/js/Clipperz/PM/DataModel/OneTimePasswordManager.js b/frontend/beta/js/Clipperz/PM/DataModel/OneTimePasswordManager.js
index aa40aba..1ebb615 100644
--- a/frontend/beta/js/Clipperz/PM/DataModel/OneTimePasswordManager.js
+++ b/frontend/beta/js/Clipperz/PM/DataModel/OneTimePasswordManager.js
@@ -1,214 +1,212 @@
/*
-Copyright 2008-2011 Clipperz Srl
+Copyright 2008-2013 Clipperz Srl
-This file is part of Clipperz Community Edition.
-Clipperz Community Edition is an online password manager.
+This file is part of Clipperz, the online password manager.
For further information about its features and functionalities please
refer to http://www.clipperz.com.
-* Clipperz Community Edition is free software: you can redistribute
- it and/or modify it under the terms of the GNU Affero General Public
- License as published by the Free Software Foundation, either version
- 3 of the License, or (at your option) any later version.
+* Clipperz is free software: you can redistribute it and/or modify it
+ under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
-* Clipperz Community Edition is distributed in the hope that it will
- be useful, but WITHOUT ANY WARRANTY; without even the implied
- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+* Clipperz is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Affero General Public License for more details.
* You should have received a copy of the GNU Affero General Public
- License along with Clipperz Community Edition. If not, see
- <http://www.gnu.org/licenses/>.
+ License along with Clipperz. If not, see http://www.gnu.org/licenses/.
*/
if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; }
//#############################################################################
Clipperz.PM.DataModel.OneTimePasswordManager = function(anUser, args) {
args = args || {};
this._user = anUser;
this._oneTimePasswords = {};
this.updateWithData(args);
Clipperz.NotificationCenter.notify(null, 'oneTimePasswordAdded', null, true);
return this;
}
Clipperz.PM.DataModel.OneTimePasswordManager.prototype = MochiKit.Base.update(null, {
'toString': function() {
return "Clipperz.PM.DataModel.OneTimePasswordManager";
},
//-------------------------------------------------------------------------
'updateWithData': function(someValues) {
var otpReference;
//console.log("OneTimePasswordManager.updateWithData", someValues);
//MochiKit.Logging.logDebug("OneTimePasswordManager.updateWithData: " + Clipperz.Base.serializeJSON(someValues));
for (otpReference in someValues) {
var otp;
var otpConfiguration;
otpConfiguration = someValues[otpReference];
otpConfiguration['user'] = this.user();
otpConfiguration['reference'] = otpReference;
otp = new Clipperz.PM.DataModel.OneTimePassword(otpConfiguration);
this._oneTimePasswords[otpReference] = otp;
}
return this;
},
//-------------------------------------------------------------------------
'updateWithServerData': function(someValues) {
var deferredResult;
var oneTimePasswordReference;
var wereChangesApplied;
//MochiKit.Logging.logDebug(">>> OneTimePasswordManager.updateWithServerData");
deferredResult = new MochiKit.Async.Deferred();
wereChangesApplied = false;
for (oneTimePasswordReference in someValues) {
var oneTimePassword;
oneTimePassword = this.oneTimePasswordWithReference(oneTimePasswordReference);
if (oneTimePassword != null) {
var oneTimePasswordHasBeenUpdated;
oneTimePasswordHasBeenUpdated = oneTimePassword.updateStatusWithValues(someValues[oneTimePasswordReference]);
wereChangesApplied = oneTimePasswordHasBeenUpdated || wereChangesApplied;
} else {
}
}
if (wereChangesApplied == true) {
this.user().header().markSectionAsUpdated('oneTimePasswords');
}
for (oneTimePasswordReference in this.oneTimePasswords()) {
if (typeof(someValues[oneTimePasswordReference]) == 'undefind') {
deferredResult.addCallback(MochiKit.Base.method(this.oneTimePasswordWithReference(oneTimePasswordReference), 'saveChanges'));
}
}
deferredResult.addCallback(MochiKit.Async.succeed, this);
deferredResult.callback();
//MochiKit.Logging.logDebug("<<< OneTimePasswordManager.updateWithServerData");
return deferredResult;
},
//-------------------------------------------------------------------------
'user': function() {
return this._user;
},
//-------------------------------------------------------------------------
'addOneTimePassword': function(aOneTimePassword, isBatchUpdate) {
this.oneTimePasswords()[aOneTimePassword.reference()] = aOneTimePassword;
if (isBatchUpdate != true) {
Clipperz.NotificationCenter.notify(aOneTimePassword, 'oneTimePasswordAdded');
Clipperz.NotificationCenter.notify(this.user(), 'updatedSection', 'oneTimePasswords', true);
}
},
//-------------------------------------------------------------------------
'archiveOneTimePassword': function(aOneTimePasswordReference) {
var deferredResult;
//MochiKit.Logging.logDebug(">>> OneTimePasswordManager.archiveOneTimePassword");
//MochiKit.Logging.logDebug("--- OneTimePasswordManager.archiveOneTimePassword - 0 otp.reference: " + aOneTimePasswordReference);
deferredResult = new MochiKit.Async.Deferred();
deferredResult.addCallback(MochiKit.Base.method(this.user(), 'loadOneTimePasswords'));
deferredResult.addCallback(MochiKit.Base.bind(function(aOneTimePasswordReference) {
var oneTimePassword;
//MochiKit.Logging.logDebug("--- OneTimePasswordManager.archiveOneTimePassword - 1 serializedData: " + Clipperz.Base.serializeJSON(this.serializedData()));
oneTimePassword = this.oneTimePasswords()[aOneTimePasswordReference];
if (oneTimePassword != null) {
oneTimePassword.setUsageDate(new Date());
// while (this.usedOneTimePasswords().length > 10) {
// var referenceOfOneTimePasswordToRemove;
//
// referenceOfOneTimePasswordToRemove = this.usedOneTimePasswords()[0];
// delete this.oneTimePasswords()[referenceOfOneTimePasswordToRemove];
// this.usedOneTimePasswords().shift();
// }
Clipperz.NotificationCenter.notify(this.user(), 'updatedSection', 'oneTimePasswords', true);
} else {
MochiKit.Logging.logError("### OneTimePasswordManager.archiveOneTimePassword - the used OneTimePassword has not been found on the index-card. :-(");
}
//MochiKit.Logging.logDebug("--- OneTimePasswordManager.archiveOneTimePassword - 2 serializedData: " + Clipperz.Base.serializeJSON(this.serializedData()));
}, this), aOneTimePasswordReference);
deferredResult.addCallback(MochiKit.Base.method(this, 'saveChanges'));
deferredResult.callback();
//MochiKit.Logging.logDebug("<<< OneTimePasswordManager.archiveOneTimePassword");
return deferredResult;
},
//-------------------------------------------------------------------------
'serializedData': function() {
var result;
var key;
result = {};
for (key in this.oneTimePasswords()) {
result[key] = this.oneTimePasswords()[key].serializedData();
}
return result;
},
//-------------------------------------------------------------------------
'oneTimePasswords': function() {
return this._oneTimePasswords;
},
//-------------------------------------------------------------------------
'oneTimePasswordWithReference': function(aOneTimePasswordReference) {
return this.oneTimePasswords()[aOneTimePasswordReference];
},
//-------------------------------------------------------------------------
'deleteOneTimePasswordWithReference': function(aOneTimePasswordReference) {
delete(this.oneTimePasswords()[aOneTimePasswordReference]);
Clipperz.NotificationCenter.notify(this.user(), 'updatedSection', 'oneTimePasswords', true);
},
//-------------------------------------------------------------------------
'encryptedData': function() {
var deferredResult;
var oneTimePasswordReferences;
var result;
var i, c;
diff --git a/frontend/beta/js/Clipperz/PM/DataModel/Record.js b/frontend/beta/js/Clipperz/PM/DataModel/Record.js
index f89f79c..7b06f29 100644
--- a/frontend/beta/js/Clipperz/PM/DataModel/Record.js
+++ b/frontend/beta/js/Clipperz/PM/DataModel/Record.js
@@ -1,214 +1,212 @@
/*
-Copyright 2008-2011 Clipperz Srl
+Copyright 2008-2013 Clipperz Srl
-This file is part of Clipperz Community Edition.
-Clipperz Community Edition is an online password manager.
+This file is part of Clipperz, the online password manager.
For further information about its features and functionalities please
refer to http://www.clipperz.com.
-* Clipperz Community Edition is free software: you can redistribute
- it and/or modify it under the terms of the GNU Affero General Public
- License as published by the Free Software Foundation, either version
- 3 of the License, or (at your option) any later version.
+* Clipperz is free software: you can redistribute it and/or modify it
+ under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
-* Clipperz Community Edition is distributed in the hope that it will
- be useful, but WITHOUT ANY WARRANTY; without even the implied
- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+* Clipperz is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Affero General Public License for more details.
* You should have received a copy of the GNU Affero General Public
- License along with Clipperz Community Edition. If not, see
- <http://www.gnu.org/licenses/>.
+ License along with Clipperz. If not, see http://www.gnu.org/licenses/.
*/
if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; }
//#############################################################################
Clipperz.PM.DataModel.Record = function(args) {
args = args || {};
this._user = args['user'] || null;
this._reference = args['reference'] || Clipperz.PM.Crypto.randomKey();
this._version = args['version'] || Clipperz.PM.Crypto.encryptingFunctions.currentVersion;
this._key = args['key'] || Clipperz.PM.Crypto.randomKey();
this.setLabel(args['label'] || Clipperz.PM.Strings['newRecordTitleLabel']);
this.setHeaderNotes(args['headerNotes'] || null);
this.setNotes(args['notes'] || args['headerNotes'] || "");
//MochiKit.Logging.logDebug("--- new Record ('" + this._label + "')- _headerNotes: '" + this._headerNotes + "'");
//MochiKit.Logging.logDebug("--- new Record ('" + this._label + "')- _notes: '" + this._notes + "'");
// this._notes = args.notes || "";
this._versions = {};
this._directLogins = {};
this._removedDirectLogins = [];
this.setIsBrandNew(args['reference'] == null);
this.setShouldLoadData(this.isBrandNew() ? false: true);
this.setShouldDecryptData(this.isBrandNew() ? false: true);
this.setShouldProcessData(this.isBrandNew() ? false: true);
this.setCurrentVersion(this.isBrandNew() ? new Clipperz.PM.DataModel.RecordVersion(this, null): null);
this.setCurrentVersionKey(null);
this._serverData = null;
this._decryptedData = null;
this._cachedData = null;
return this;
}
Clipperz.PM.DataModel.Record.prototype = MochiKit.Base.update(null, {
'toString': function() {
return "Record (" + this.label() + ")";
},
//-------------------------------------------------------------------------
'isBrandNew': function() {
return this._isBrandNew;
},
'setIsBrandNew': function(aValue) {
this._isBrandNew = aValue;
},
//-------------------------------------------------------------------------
/*
'shouldRunTheRecordCreationWizard': function() {
return (this.isBrandNew() && (MochiKit.Base.keys(this.currentVersion().fields()).length == 0));
},
*/
//-------------------------------------------------------------------------
'user': function() {
return this._user;
},
//-------------------------------------------------------------------------
'reference': function() {
return this._reference;
},
//-------------------------------------------------------------------------
'key': function() {
return this._key;
},
'updateKey': function() {
this._key = Clipperz.PM.Crypto.randomKey();
},
//-------------------------------------------------------------------------
'label': function() {
return this._label;
},
'setLabel': function(aValue) {
this._label = aValue;
},
'lowerCaseLabel': function() {
return this.label().toLowerCase();
},
//-------------------------------------------------------------------------
'versions': function() {
return this._versions;
},
//-------------------------------------------------------------------------
'currentVersion': function() {
return this._currentVersion;
},
'setCurrentVersion': function(aValue) {
this._currentVersion = aValue;
},
//-------------------------------------------------------------------------
'currentVersionKey': function() {
return this._currentVersionKey;
},
'setCurrentVersionKey': function(aValue) {
this._currentVersionKey = aValue;
},
//-------------------------------------------------------------------------
'deferredData': function() {
var deferredResult;
//MochiKit.Logging.logDebug(">>> [" + (new Date()).valueOf() + "] Record.deferredData - this: " + this);
deferredResult = new MochiKit.Async.Deferred();
deferredResult.addCallback(MochiKit.Base.method(this, 'loadData'));
deferredResult.addCallback(MochiKit.Base.method(this, 'decryptData'));
deferredResult.addCallback(MochiKit.Base.method(this, 'processData'));
deferredResult.addCallback(function(aRecord) {
return aRecord.currentVersion().deferredData();
});
deferredResult.addCallback(MochiKit.Base.method(this, 'takeSnapshotOfCurrentData'));
deferredResult.addCallback(MochiKit.Async.succeed, this);
deferredResult.callback();
//MochiKit.Logging.logDebug("<<< [" + (new Date()).valueOf() + "] Record.deferredData");
return deferredResult;
},
//-------------------------------------------------------------------------
'exportedData': function() {
var result;
result = {};
result['label'] = this.label();
result['data'] = this.serializedData();
result['currentVersion'] = this.currentVersion().serializedData();
result['currentVersion']['reference'] = this.currentVersion().reference();
// result['versions'] = MochiKit.Base.map(MochiKit.Base.methodcaller("serializedData"), MochiKit.Base.values(this.versions()));
return Clipperz.Base.serializeJSON(result);
},
//-------------------------------------------------------------------------
'shouldLoadData': function() {
return this._shouldLoadData;
},
'setShouldLoadData': function(aValue) {
this._shouldLoadData = aValue;
},
//-------------------------------------------------------------------------
'shouldDecryptData': function() {
return this._shouldDecryptData;
},
'setShouldDecryptData': function(aValue) {
this._shouldDecryptData = aValue;
},
//-------------------------------------------------------------------------
'shouldProcessData': function() {
return this._shouldProcessData;
},
diff --git a/frontend/beta/js/Clipperz/PM/DataModel/RecordField.js b/frontend/beta/js/Clipperz/PM/DataModel/RecordField.js
index bca664d..a5d7980 100644
--- a/frontend/beta/js/Clipperz/PM/DataModel/RecordField.js
+++ b/frontend/beta/js/Clipperz/PM/DataModel/RecordField.js
@@ -1,214 +1,212 @@
/*
-Copyright 2008-2011 Clipperz Srl
+Copyright 2008-2013 Clipperz Srl
-This file is part of Clipperz Community Edition.
-Clipperz Community Edition is an online password manager.
+This file is part of Clipperz, the online password manager.
For further information about its features and functionalities please
refer to http://www.clipperz.com.
-* Clipperz Community Edition is free software: you can redistribute
- it and/or modify it under the terms of the GNU Affero General Public
- License as published by the Free Software Foundation, either version
- 3 of the License, or (at your option) any later version.
+* Clipperz is free software: you can redistribute it and/or modify it
+ under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
-* Clipperz Community Edition is distributed in the hope that it will
- be useful, but WITHOUT ANY WARRANTY; without even the implied
- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+* Clipperz is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Affero General Public License for more details.
* You should have received a copy of the GNU Affero General Public
- License along with Clipperz Community Edition. If not, see
- <http://www.gnu.org/licenses/>.
+ License along with Clipperz. If not, see http://www.gnu.org/licenses/.
*/
if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; }
//#############################################################################
Clipperz.PM.DataModel.RecordField = function(args) {
args = args || {};
this._recordVersion = args.recordVersion || null;
this._key = args.key || Clipperz.PM.Crypto.randomKey();
this.setLabel(args.label || '');
this.setValue(args.value || '');
this.setType(args.type || 'TXT'); // valid types: 'TXT', 'PWD', 'URL', 'DATE', 'ADDR', 'CHECK', 'RADIO', ('NOTE' probably not), ...
this._hidden = args.hidden || (args.type == 'PWD') || false;
return this;
}
Clipperz.PM.DataModel.RecordField.prototype = MochiKit.Base.update(null, {
'toString': function() {
return "Clipperz.PM.DataModel.RecordField - " + this.label() + " (" + this.key() + ")";
},
//-------------------------------------------------------------------------
'recordVersion': function() {
return this._recordVersion;
},
//-------------------------------------------------------------------------
'key': function() {
return this._key;
},
//-------------------------------------------------------------------------
'label': function() {
return this._label;
},
'setLabel': function(aValue) {
this._label = aValue;
},
//-------------------------------------------------------------------------
'value': function() {
return this._value;
},
'setValue': function(aValue) {
this._value = aValue;
},
//-------------------------------------------------------------------------
'type': function() {
return this._type;
},
'setType': function(aValue) {
this._type = aValue;
if (aValue == 'PWD') {
this.setHidden(true);
} else {
this.setHidden(false);
}
},
//-------------------------------------------------------------------------
'serializeData': function() {
var result;
//MochiKit.Logging.logDebug(">>> RecordField.serializeData - " + this);
result = {
label: this.label(),
value: this.value(),
type: this.type(),
hidden: this.hidden()
};
//MochiKit.Logging.logDebug("<<< RecordField.serializeData");
return result;
},
//-------------------------------------------------------------------------
'typeShortDescription': function() {
// return Clipperz.PM.DataModel.RecordField.TypeDescriptions[this.type()]['shortDescription'];
return Clipperz.PM.Strings['recordFieldTypologies'][this.type()]['shortDescription'];
},
//-------------------------------------------------------------------------
'hidden': function() {
return this._hidden;
},
'setHidden': function(aValue) {
this._hidden = aValue;
},
//-------------------------------------------------------------------------
'clone': function(aRecordVersion) {
var result;
result = new Clipperz.PM.DataModel.RecordField({
recordVersion:aRecordVersion,
label:this.label(),
value:this.value(),
type:this.type(),
hidden:this.hidden()
});
return result;
},
//-------------------------------------------------------------------------
'isEmpty': function() {
var result;
if ((this.label() == "") && (this.value() == "") && (this.type() == 'TXT')) {
result = true;
} else {
result = false;
}
return result;
},
//-------------------------------------------------------------------------
__syntaxFix__: "syntax fix"
});
//#############################################################################
/*
Clipperz.PM.DataModel.RecordField.TypeDescriptions = {
'TXT': {
description: 'simple text field',
shortDescription: 'txt'
},
'PWD': {
description: 'simple text field, with default status set to hidden',
shortDescription: 'pwd'
},
'URL': {
description: 'simple text field in edit mode, that became an active url in view mode',
shortDescription: 'url'
},
'DATE': {
description: 'a value set with a calendar helper',
shortDescription: 'date'
},
'ADDR': {
description: 'just like the URL, but the active link points to Google Maps (or similar service) passing the address value as argument',
shortDescription: 'addr'
},
'CHECK': {
description: 'check description',
shortDescription: 'check'
},
'RADIO': {
description: 'radio description',
shortDescription: 'radio'
},
'SELECT': {
description: 'select description',
shortDescription: 'select'
}
// 'NOTE': {
// description: 'a simple text field, but with a bigger component dimension; possibly with "smart edit components"',
// shortDescription: 'note'
// }
};
Clipperz.PM.DataModel.RecordField.InputTypeToRecordFieldType = {
'text': 'TXT',
'password': 'PWD',
'checkbox': 'CHECK',
'radio': 'RADIO',
diff --git a/frontend/beta/js/Clipperz/PM/DataModel/RecordVersion.js b/frontend/beta/js/Clipperz/PM/DataModel/RecordVersion.js
index fc4a45c..69a7d91 100644
--- a/frontend/beta/js/Clipperz/PM/DataModel/RecordVersion.js
+++ b/frontend/beta/js/Clipperz/PM/DataModel/RecordVersion.js
@@ -1,214 +1,212 @@
/*
-Copyright 2008-2011 Clipperz Srl
+Copyright 2008-2013 Clipperz Srl
-This file is part of Clipperz Community Edition.
-Clipperz Community Edition is an online password manager.
+This file is part of Clipperz, the online password manager.
For further information about its features and functionalities please
refer to http://www.clipperz.com.
-* Clipperz Community Edition is free software: you can redistribute
- it and/or modify it under the terms of the GNU Affero General Public
- License as published by the Free Software Foundation, either version
- 3 of the License, or (at your option) any later version.
+* Clipperz is free software: you can redistribute it and/or modify it
+ under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
-* Clipperz Community Edition is distributed in the hope that it will
- be useful, but WITHOUT ANY WARRANTY; without even the implied
- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+* Clipperz is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Affero General Public License for more details.
* You should have received a copy of the GNU Affero General Public
- License along with Clipperz Community Edition. If not, see
- <http://www.gnu.org/licenses/>.
+ License along with Clipperz. If not, see http://www.gnu.org/licenses/.
*/
if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; }
//#############################################################################
Clipperz.PM.DataModel.RecordVersion = function(aRecord, args) {
args = args || {};
this._record = aRecord;
this._reference = args.reference || Clipperz.PM.Crypto.randomKey();
this._version = args.version || Clipperz.PM.Crypto.encryptingFunctions.currentVersion;
this._key = args.key || Clipperz.PM.Crypto.randomKey();;
this._previousVersion = args.previousVersion || null;
this._previousVersionKey = args.previousVersionKey || null;
this.setIsBrandNew(args.reference == null);
if (this.isBrandNew()) {
this._fields = {};
this.setShouldLoadData(false);
this.setShouldDecryptData(false);
this.setShouldProcessData(false);
} else {
if (typeof(args.fields) != 'undefined') {
this.processFieldData(args.fields);
this.setShouldLoadData(false);
this.setShouldDecryptData(false);
this.setShouldProcessData(false);
} else {
if (typeof(args.data) != 'undefined') {
this.setShouldLoadData(false);
} else {
this.setShouldLoadData(true);
}
this.setShouldDecryptData(true);
this.setShouldProcessData(true);
}
}
this._serverData = args.data;
this._decryptedData = null;
return this;
}
Clipperz.PM.DataModel.RecordVersion.prototype = MochiKit.Base.update(null, {
'toString': function() {
return "RecordVersion";
},
//-------------------------------------------------------------------------
'record': function() {
return this._record;
},
//-------------------------------------------------------------------------
'reference': function() {
return this._reference;
},
'setReference': function(aValue) {
this._reference = aValue;
},
//-------------------------------------------------------------------------
'key': function() {
//MochiKit.Logging.logDebug(">>> RecordVersion.key");
//MochiKit.Logging.logDebug("--- RecordVersion.key - " + this._key);
return this._key;
},
'setKey': function(aValue) {
this._key = aValue;
},
//-------------------------------------------------------------------------
'serverData': function() {
return this._serverData;
},
'setServerData': function(aValue) {
this._serverData = aValue;
this.setShouldLoadData(false);
return aValue;
},
//-------------------------------------------------------------------------
'decryptedData': function() {
//MochiKit.Logging.logDebug(">>> RecordVersion.decryptedData: " + (this._decryptedData ? Clipperz.Base.serializeJSON(aValue) : "null"));
return this._decryptedData;
},
'setDecryptedData': function(aValue) {
//MochiKit.Logging.logDebug(">>> RecordVersion.setDecryptedData: " + Clipperz.Base.serializeJSON(aValue));
this._decryptedData = aValue;
this.setShouldDecryptData(false);
return aValue;
},
//-------------------------------------------------------------------------
'version': function() {
return this._version;
},
//-------------------------------------------------------------------------
'isBrandNew': function() {
return this._isBrandNew;
},
'setIsBrandNew': function(aValue) {
this._isBrandNew = aValue;
},
//-------------------------------------------------------------------------
'fields': function() {
return this._fields;
},
'addField': function(aField) {
this.fields()[aField.key()] = aField;
},
'addNewField': function() {
var newRecordField;
newRecordField = new Clipperz.PM.DataModel.RecordField({recordVersion:this});
this.addField(newRecordField);
return newRecordField;
},
'fieldWithName': function(aValue) {
var result;
var fieldValues;
var i,c;
result = null;
fieldValues = MochiKit.Base.values(this.fields());
c = fieldValues.length;
for (i=0; (i<c) && (result == null); i++) {
var currentField;
currentField = fieldValues[i];
if (currentField.label() == aValue) {
result = currentField;
}
}
return result;
},
//-------------------------------------------------------------------------
'shouldLoadData': function() {
return this._shouldLoadData;
},
'setShouldLoadData': function(aValue) {
this._shouldLoadData = aValue;
},
//-------------------------------------------------------------------------
'shouldDecryptData': function() {
return this._shouldDecryptData;
},
'setShouldDecryptData': function(aValue) {
this._shouldDecryptData = aValue;
},
//-------------------------------------------------------------------------
'shouldProcessData': function() {
diff --git a/frontend/beta/js/Clipperz/PM/DataModel/Statistics.js b/frontend/beta/js/Clipperz/PM/DataModel/Statistics.js
index 3d53adf..f0c229e 100644
--- a/frontend/beta/js/Clipperz/PM/DataModel/Statistics.js
+++ b/frontend/beta/js/Clipperz/PM/DataModel/Statistics.js
@@ -1,130 +1,128 @@
/*
-Copyright 2008-2011 Clipperz Srl
+Copyright 2008-2013 Clipperz Srl
-This file is part of Clipperz Community Edition.
-Clipperz Community Edition is an online password manager.
+This file is part of Clipperz, the online password manager.
For further information about its features and functionalities please
refer to http://www.clipperz.com.
-* Clipperz Community Edition is free software: you can redistribute
- it and/or modify it under the terms of the GNU Affero General Public
- License as published by the Free Software Foundation, either version
- 3 of the License, or (at your option) any later version.
+* Clipperz is free software: you can redistribute it and/or modify it
+ under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
-* Clipperz Community Edition is distributed in the hope that it will
- be useful, but WITHOUT ANY WARRANTY; without even the implied
- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+* Clipperz is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Affero General Public License for more details.
* You should have received a copy of the GNU Affero General Public
- License along with Clipperz Community Edition. If not, see
- <http://www.gnu.org/licenses/>.
+ License along with Clipperz. If not, see http://www.gnu.org/licenses/.
*/
if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; }
//#############################################################################
Clipperz.PM.DataModel.Statistics = function(args) {
args = args || {};
this._user = args.user;
this._data = args.data || null;
return this;
}
Clipperz.PM.DataModel.Statistics.prototype = MochiKit.Base.update(null, {
//-------------------------------------------------------------------------
'decrypt': function(aVersion, someEncryptedData) {
var deferredResult;
//MochiKit.Logging.logDebug(">>> Statistics.decrypt");
if (someEncryptedData == Clipperz.PM.Crypto.nullValue) {
this.setData({});
deferredResult = MochiKit.Async.succeed(this.data());
} else {
var statistic;
var user;
statistic = this;
user = this.user();
deferredResult = new MochiKit.Async.Deferred();
//deferredResult.addCallback(function() { console.time("Statistics.decrypt.deferredDecrypt")});
deferredResult.addCallback(Clipperz.PM.Crypto.deferredDecrypt, user.passphrase(), someEncryptedData, aVersion);
//deferredResult.addCallback(function() { console.timeEnd("Statistics.decrypt.deferredDecrypt")});
//deferredResult.addCallback(function() { console.time("Statistics.decrypt.setup")});
deferredResult.addCallbacks(
MochiKit.Base.partial(function (aStatistic, someData) {
aStatistic.setData(someData);
return aStatistic.data();
}, statistic),
MochiKit.Base.partial(function (aStatistic) {
MochiKit.Logging.logWarning("resetting user statistics due to an error while decrypting stored data");
aStatistic.setData({});
return aStatistic.data();
}, statistic)
);
//deferredResult.addCallback(function() { console.timeEnd("Statistics.decrypt.setup")});
deferredResult.callback();
}
//MochiKit.Logging.logDebug("<<< Statistics.decrypt");
return deferredResult;
},
//-------------------------------------------------------------------------
'user': function() {
return this._user;
},
//-------------------------------------------------------------------------
'data': function() {
return this._data;
},
'setData': function(aValue) {
this._data = aValue;
this.extractInfoFromData(aValue);
},
//-------------------------------------------------------------------------
'extractInfoFromData': function(someValues) {
},
//-------------------------------------------------------------------------
'encryptedData': function() {
return Clipperz.PM.Crypto.deferredEncryptWithCurrentVersion(this.user().passphrase(), this.serializedData());
},
//-------------------------------------------------------------------------
'serializedData': function() {
var result;
//MochiKit.Logging.logDebug(">>> Statistics.serializedData");
result = {};
//MochiKit.Logging.logDebug("<<< Statistics.serializedData");
return result;
},
//-------------------------------------------------------------------------
__syntaxFix__: "syntax fix"
});
diff --git a/frontend/beta/js/Clipperz/PM/DataModel/User.js b/frontend/beta/js/Clipperz/PM/DataModel/User.js
index b29d224..3067742 100644
--- a/frontend/beta/js/Clipperz/PM/DataModel/User.js
+++ b/frontend/beta/js/Clipperz/PM/DataModel/User.js
@@ -1,214 +1,212 @@
/*
-Copyright 2008-2011 Clipperz Srl
+Copyright 2008-2013 Clipperz Srl
-This file is part of Clipperz Community Edition.
-Clipperz Community Edition is an online password manager.
+This file is part of Clipperz, the online password manager.
For further information about its features and functionalities please
refer to http://www.clipperz.com.
-* Clipperz Community Edition is free software: you can redistribute
- it and/or modify it under the terms of the GNU Affero General Public
- License as published by the Free Software Foundation, either version
- 3 of the License, or (at your option) any later version.
+* Clipperz is free software: you can redistribute it and/or modify it
+ under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
-* Clipperz Community Edition is distributed in the hope that it will
- be useful, but WITHOUT ANY WARRANTY; without even the implied
- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+* Clipperz is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Affero General Public License for more details.
* You should have received a copy of the GNU Affero General Public
- License along with Clipperz Community Edition. If not, see
- <http://www.gnu.org/licenses/>.
+ License along with Clipperz. If not, see http://www.gnu.org/licenses/.
*/
if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; }
//#############################################################################
Clipperz.PM.DataModel.User = function(args) {
//MochiKit.Logging.logDebug(">>> new User");
args = args || {};
this._username = args.username || null;
this._passphrase = args.passphrase || null;
this._connection = null;
this._connectionVersion = 'current';
this._header = null;
this._statistics = null;
this._lock = 'new lock';
this._preferences = null;
this._records = {};
this._directLoginReferences = {};
this._oneTimePasswordManager = null;
this._isLoadingUserDetails = false;
this._loadingUserDetailsPendingQueue = [];
this._maxNumberOfRecords = Number.MAX_VALUE;
this._shouldDownloadOfflineCopy = false;
this._loginInfo = null;
this._loginHistory = null;
this._serverData = null;
//MochiKit.Logging.logDebug("<<< new User");
return this;
}
Clipperz.PM.DataModel.User.prototype = MochiKit.Base.update(null, {
'toString': function() {
return "Clipperz.PM.DataModel.User - " + this.username();
},
//-------------------------------------------------------------------------
'username': function() {
return this._username;
},
'setUsername': function(aValue) {
this._username = aValue;
},
//-------------------------------------------------------------------------
'passphrase': function() {
return this._passphrase;
},
'setPassphrase': function(aValue) {
this._passphrase = aValue;
},
//-------------------------------------------------------------------------
'maxNumberOfRecords': function() {
return this._maxNumberOfRecords;
},
'setMaxNumberOfRecords': function(aValue) {
this._maxNumberOfRecords = aValue;
},
//-------------------------------------------------------------------------
'errorHandler': function(anErrorString, anException) {
MochiKit.Logging.logError("- User.errorHandler: " + anErrorString + " (" + anException + ")");
},
//-------------------------------------------------------------------------
'connectionVersion': function() {
return this._connectionVersion;
},
'setConnectionVersion': function(aValue) {
this._connectionVersion = aValue;
},
//-------------------------------------------------------------------------
'connection': function() {
if ((this._connection == null) && (this.connectionVersion() != null) ){
this._connection = new Clipperz.PM.Crypto.communicationProtocol.versions[this.connectionVersion()]({user:this});
}
return this._connection;
},
'resetConnection': function(aValue) {
this._connection = null;
},
//=========================================================================
'register': function(anInvitationCode) {
var deferredResult;
var prng;
//MochiKit.Logging.logError(">>> User.register: " + this);
prng = Clipperz.Crypto.PRNG.defaultRandomGenerator();
deferredResult = new MochiKit.Async.Deferred()
//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.register - 1: " + res); return res;});
deferredResult.addCallback(MochiKit.Base.method(prng, 'deferredEntropyCollection'));
//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.register - 2: " + res); return res;});
deferredResult.addCallback(MochiKit.Base.method(this.header(), 'updateAllSections'), anInvitationCode);
//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.register - 2.1: " + res); return res;});
deferredResult.addCallback(MochiKit.Base.method(this.connection(), 'register'), anInvitationCode);
//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("User.register - 3: " + res); return res;});
deferredResult.callback();
//MochiKit.Logging.logError("<<< User.register");
return deferredResult;
},
//=========================================================================
'connect': function(aValue) {
var deferredResult;
var prng;
prng = Clipperz.Crypto.PRNG.defaultRandomGenerator();
//MochiKit.Logging.logDebug(">>> User.connect");
deferredResult = new MochiKit.Async.Deferred();
//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("1.2.1 - User.connect - 1: "/* + res*/); return res;});
//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
deferredResult.addCallback(MochiKit.Base.method(prng, 'deferredEntropyCollection'));
//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("1.2.2 - User.connect - 2: "/* + res*/); return res;});
//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
deferredResult.addCallback(MochiKit.Base.method(this.connection(), 'login'));
//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("1.2.3 - User.connect - 3: "/* + res*/); return res;});
//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
// TODO: add an addErrback call here to manage a wrong login. Any error after this point is due to some other causes.
// possibly the same exact 'handleConnectionFallback use at the end of this same method.
if (this.connectionVersion() != 'current') {
var currentConnection;
currentVersionConnection = new Clipperz.PM.Crypto.communicationProtocol.versions['current']({user:this});
//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("1.2.4 - User.connect - 4: "/* + res*/); return res;});
//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'connection_upgrading');
//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("1.2.5 - User.connect - 5: "/* + res*/); return res;});
//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
deferredResult.addCallback(MochiKit.Base.method(this.connection(), 'message'), 'upgradeUserCredentials', currentVersionConnection.serverSideUserCredentials());
//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("1.2.6 - User.connect - 6: "/* + res*/); return res;});
//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
}
//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("1.2.7 - User.connect - 7: "/* + res*/); return res;});
//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'userConnected', null);
//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("1.2.8 - User.connect - 8: "/* + res*/); return res;});
//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
deferredResult.addErrback(MochiKit.Base.method(this, 'handleConnectionFallback'));
//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("1.2.9 - User.connect - 9: "/* + res*/); return res;});
//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("ERROR: " + res); return res;});
deferredResult.callback(aValue);
//MochiKit.Logging.logDebug("<<< User.connect");
return deferredResult;
},
//.........................................................................
'handleConnectionFallback': function(aValue) {
var result;
//MochiKit.Logging.logDebug(">>> User.handleConnectionFallback");
if (aValue instanceof MochiKit.Async.CancelledError) {
diff --git a/frontend/beta/js/Clipperz/PM/DataModel/UserPreferences.js b/frontend/beta/js/Clipperz/PM/DataModel/UserPreferences.js
index 919289d..d44ad89 100644
--- a/frontend/beta/js/Clipperz/PM/DataModel/UserPreferences.js
+++ b/frontend/beta/js/Clipperz/PM/DataModel/UserPreferences.js
@@ -1,195 +1,193 @@
/*
-Copyright 2008-2011 Clipperz Srl
+Copyright 2008-2013 Clipperz Srl
-This file is part of Clipperz Community Edition.
-Clipperz Community Edition is an online password manager.
+This file is part of Clipperz, the online password manager.
For further information about its features and functionalities please
refer to http://www.clipperz.com.
-* Clipperz Community Edition is free software: you can redistribute
- it and/or modify it under the terms of the GNU Affero General Public
- License as published by the Free Software Foundation, either version
- 3 of the License, or (at your option) any later version.
+* Clipperz is free software: you can redistribute it and/or modify it
+ under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
-* Clipperz Community Edition is distributed in the hope that it will
- be useful, but WITHOUT ANY WARRANTY; without even the implied
- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+* Clipperz is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Affero General Public License for more details.
* You should have received a copy of the GNU Affero General Public
- License along with Clipperz Community Edition. If not, see
- <http://www.gnu.org/licenses/>.
+ License along with Clipperz. If not, see http://www.gnu.org/licenses/.
*/
if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
if (typeof(Clipperz.PM.DataModel) == 'undefined') { Clipperz.PM.DataModel = {}; }
//#############################################################################
Clipperz.PM.DataModel.UserPreferences = function(args) {
args = args || {};
this._user = args['user']; delete args['user'];
this._config = args;
return this;
}
Clipperz.PM.DataModel.UserPreferences.prototype = MochiKit.Base.update(null, {
//-------------------------------------------------------------------------
'config': function() {
return this._config;
},
//-------------------------------------------------------------------------
'user': function() {
return this._user;
},
//-------------------------------------------------------------------------
'updateWithData': function(someValues) {
var currentLanguage;
//MochiKit.Logging.logDebug(">>> Clipperz.PM.DataModel.UserPreferences.updateWithData: " + Clipperz.Base.serializeJSON(someValues));
currentLanguage = this.preferredLanguage();
MochiKit.Base.update(this._config, someValues);
if (this.preferredLanguage() != currentLanguage) {
Clipperz.PM.Strings.Languages.setSelectedLanguage(this.preferredLanguage());
} else {
//MochiKit.Logging.logDebug("### keepping the browser selected language: " + Clipperz.PM.Strings.selectedLanguage);
}
return this;
},
//-------------------------------------------------------------------------
'configValue': function(aConfigName, aDefaultValue) {
var result;
//MochiKit.Logging.logDebug(">>> UserPreferences.configValue - config: " + Clipperz.Base.serializeJSON(this.config()));
if (typeof(this.config()[aConfigName]) == 'undefined') {
result = aDefaultValue;
} else {
result = this.config()[aConfigName];
}
//MochiKit.Logging.logDebug("<<< UserPreferences.configValue");
return result;
},
'setConfigValue': function(aConfigName, aValue) {
var result;
if (aValue != this.configValue(aConfigName)) {
if (aValue == null) {
delete this.config()[aConfigName]
} else {
this.config()[aConfigName] = aValue;
}
Clipperz.NotificationCenter.notify(this.user(), 'updatedSection', 'preferences', true);
result = true;
} else {
result = false;
}
return result;
},
//-------------------------------------------------------------------------
'useSafeEditMode': function() {
return this.configValue('useSafeEditMode', true);
},
'setUseSafeEditMode': function(aValue) {
this.setConfigValue('useSafeEditMode', aValue);
},
//-------------------------------------------------------------------------
'preferredLanguage': function() {
return this.configValue('preferredLanguage', null);
},
'setPreferredLanguage': function(aValue) {
if (this.setConfigValue('preferredLanguage', aValue)) {
Clipperz.PM.Strings.Languages.setSelectedLanguage(this.preferredLanguage());
}
},
//-------------------------------------------------------------------------
'shouldShowDonationPanel': function() {
return this.configValue('shouldShowDonationPanel', true);
},
'setShouldShowDonationPanel': function(aValue) {
this.setConfigValue('shouldShowDonationPanel', aValue);
},
//-------------------------------------------------------------------------
'disableUnsecureFaviconLoadingForIE': function() {
return this.configValue('disableUnsecureFaviconLoadingForIE', false);
},
'setDisableUnsecureFaviconLoadingForIE': function(aValue) {
this.setConfigValue('disableUnsecureFaviconLoadingForIE', aValue);
},
//-------------------------------------------------------------------------
'serializedData': function() {
return this.config();
},
//-------------------------------------------------------------------------
'saveChanges': function(aReferenceElement) {
var deferredResult;
deferredResult = new MochiKit.Async.Deferred();
deferredResult.addCallback(MochiKit.Base.method(Clipperz.PM.Components.MessageBox(), 'deferredShow'),
{
title:"", // Clipperz.PM.Strings['accountPreferencesSavingPanelTitle_Step1'],
text:"", // Clipperz.PM.Strings['accountPreferencesSavingPanelText_Step1'],
width:240,
showProgressBar:true,
showCloseButton:false
},
aReferenceElement
);
deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'account_savingPreferences_1');
deferredResult.addCallback(MochiKit.Base.method(this.user(), 'encryptedData'));
deferredResult.addCallback(function(res) {
return {user:res};
})
deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'account_savingPreferences_2');
// deferredResult.addCallback(MochiKit.Base.method(this.user().connection(), 'message'), 'updateData');
deferredResult.addCallback(MochiKit.Base.method(this.user().connection(), 'message'), 'saveChanges');
deferredResult.addCallback(Clipperz.PM.Components.MessageBox().hide, YAHOO.ext.Element.get('main'));
deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedPreferences', null);
deferredResult.callback();
return deferredResult;
},
//-------------------------------------------------------------------------
__syntaxFix__: "syntax fix"
});