1
0
mirror of http://git.whoc.org.uk/git/password-manager.git synced 2025-10-25 09:37:35 +02:00

Fixes to release developer preview of the /delta version

/delta needs an updated backend to support its payment options.
/beta and /gamma have been updated to be compatible with the new backend.
This commit is contained in:
Giulio Cesare Solaroli
2014-10-09 13:55:45 +02:00
parent 093d5e7965
commit b3967dae52
30 changed files with 784 additions and 190 deletions

View File

@@ -105,9 +105,11 @@ Clipperz.Base.extend(Clipperz.PM.DataModel.Record.Version.Field, Object, {
if (someValues['isHidden']) {
result = 'PASSWORD';
} else if (Clipperz.Base.isUrl(someValues['value'])) {
result = 'URL'
result = 'URL';
// } else if (Clipperz.Base.isBitcoin(someValues['value'])) {
// result = 'BITCOIN';
} else if (Clipperz.Base.isEmail(someValues['value'])) {
result = 'EMAIL'
result = 'EMAIL';
};
return result;

View File

@@ -0,0 +1,94 @@
/*
Copyright 2008-2013 Clipperz Srl
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 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 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. If not, see http://www.gnu.org/licenses/.
*/
Clipperz.PM.DataModel.User.AccountInfo = function(args) {
Clipperz.PM.DataModel.User.AccountInfo.superclass.constructor.apply(this, arguments);
console.log("new AccountInfo", args);
// {
// "expirationDate": "Sat, 18 January 2014 11:56:17 UTC",
// "featureSet": "EXPIRED",
// "features": [
// "OFFLINE_COPY",
// "LIST_CARDS"
// ],
// "isExpired": true,
// "isExpiring": false,
// "latestActiveLevel": "TRIAL",
// "latestActiveThreshold": 0.0,
// "paymentVerificationPending": false,
// "payments": [],
// "referenceDate": "Mon, 03 March 2014 09:54:50 UTC"
// }
this._args = args;
return this;
}
//-----------------------------------------------------------------------------
Clipperz.Base.extend(Clipperz.PM.DataModel.User.AccountInfo, Object, {
'toString': function() {
return "Clipperz.PM.DataModel.User.AccountInfo";
},
'args': function () {
return this._args;
},
'expirationDate': function () {
return Clipperz.PM.Date.parse(this.args()['expirationDate']);
},
'latestActiveLevel': function () {
return this.args()['latestActiveLevel'];
},
'latestActiveThreshold': function () {
return this.args()['latestActiveThreshold'];
},
'status': function () {
return this.args()['featureSet'];
},
'isExpiring': function () {
return this.args()['isExpiring'];
},
'isExpired': function () {
return this.args()['isExpired'];
},
'paymentVerificationPending': function () {
return this.args()['paymentVerificationPending'];
},
//=========================================================================
__syntaxFix__: "syntax fix"
});
//-----------------------------------------------------------------------------

View File

@@ -327,7 +327,7 @@ Clipperz.Base.extend(Clipperz.PM.DataModel.User, Object, {
var oneTimePasswords;
// this.setServerLockValue(someServerData['lock']);
console.log("USER.unpackServerData", someServerData);
headerVersion = this.headerFormatVersion(someServerData['header']);
switch (headerVersion) {
@@ -410,7 +410,9 @@ Clipperz.Base.extend(Clipperz.PM.DataModel.User, Object, {
'recordsIndex': recordsIndex,
'preferences': preferences,
'oneTimePasswords': oneTimePasswords
}
},
// 'accountInfo': new Clipperz.PM.DataModel.User.AccountInfo(someServerData['accountInfo']),
'offlineCopyNeeded': someServerData['offlineCopyNeeded']
};
this._serverData = unpackedData;
@@ -449,6 +451,11 @@ Clipperz.Base.extend(Clipperz.PM.DataModel.User, Object, {
return deferredResult;
},
'resetAllData': function () {
this.deleteAllCleanTextData();
this._serverData = null;
},
//-------------------------------------------------------------------------
'connectionVersion': function() {
@@ -492,6 +499,13 @@ Clipperz.Base.extend(Clipperz.PM.DataModel.User, Object, {
], {trace:false})
},
'getCurrentAccountInfo': function () {
return Clipperz.Async.callbacks("User.getHeaderIndex", [
MochiKit.Base.method(this, 'getServerData'),
MochiKit.Base.itemgetter('accountInfo')
], {trace:false})
},
//=========================================================================
'getRecords': function () {
@@ -779,6 +793,20 @@ Clipperz.Base.extend(Clipperz.PM.DataModel.User, Object, {
return deferredResult;
},
'deleteAccount': function() {
var deferredResult;
//MochiKit.Logging.logDebug(">>> user.deleteAccountAction - " + this);
this.deleteAllCleanTextData();
deferredResult = new Clipperz.Async.Deferred("User.deleteAccount", {trace:false});
deferredResult.addCallback(MochiKit.Base.method(this.connection(), 'message'), 'deleteUser');
// deferredResult.addCallback(MochiKit.Base.method(this, 'resetAllLocalData'));
deferredResult.callback();
//MochiKit.Logging.logDebug("<<< user.deleteAccountAction - " + this);
return deferredResult;
},
//=========================================================================
__syntaxFix__: "syntax fix"
});