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:
@@ -49,6 +49,8 @@ Clipperz.PM.UI.Web.Controllers.AppController = function(args) {
|
||||
// MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'deleteCard', this, 'handleDeleteCard');
|
||||
|
||||
MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'userDataSuccessfullySaved', this, 'userDataSuccessfullySavedHandler');
|
||||
// MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'makePayment', this, 'handlePaymentRequest');
|
||||
MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'deleteAccount', this, 'deleteAccount');
|
||||
|
||||
return this;
|
||||
}
|
||||
@@ -125,7 +127,7 @@ MochiKit.Base.update(Clipperz.PM.UI.Web.Controllers.AppController.prototype, {
|
||||
|
||||
'accountPanel': function () {
|
||||
if (this._accountPanel == null) {
|
||||
this._accountPanel = new Clipperz.PM.UI.Web.Components.AccountPanel(/*{selected:'Preferences'}*/);
|
||||
this._accountPanel = new Clipperz.PM.UI.Web.Components.AccountPanel({credentialVefificationFunction: MochiKit.Base.bind(this.credentialVefificationFunction, this) /*, selected:'Preferences'*/});
|
||||
}
|
||||
|
||||
return this._accountPanel;
|
||||
@@ -199,6 +201,10 @@ MochiKit.Base.update(Clipperz.PM.UI.Web.Controllers.AppController.prototype, {
|
||||
]
|
||||
})
|
||||
deferredResult.addMethod(this.userInfoBox(), 'updateUserDetails');
|
||||
|
||||
deferredResult.addMethod(this.user(), 'getCurrentAccountInfo');
|
||||
// deferredResult.addMethod(this.userInfoBox(), 'updateCurrentSubscriptionDetails');
|
||||
|
||||
deferredResult.callback(this.user());
|
||||
|
||||
return deferredResult;
|
||||
@@ -343,6 +349,64 @@ MochiKit.Base.update(Clipperz.PM.UI.Web.Controllers.AppController.prototype, {
|
||||
}
|
||||
},
|
||||
|
||||
//=============================================================================
|
||||
/*
|
||||
'handlePaymentRequest': function (anEvent) {
|
||||
var deferredResult;
|
||||
var paymentController;
|
||||
|
||||
console.log("AppController - handlePaymentRequest", anEvent);
|
||||
paymentController = new Clipperz.PM.UI.Web.Controllers.PaymentController({delegate:this});
|
||||
deferredResult = paymentController.run(anEvent.src());
|
||||
|
||||
return deferredResult;
|
||||
},
|
||||
|
||||
'subscriptionOptions': function () {
|
||||
return this.user().connection().message('subscriptionOptions');
|
||||
},
|
||||
|
||||
'getPaymentSubscriptionInfo': function () {
|
||||
return this.user().connection().message('paymentRequest');
|
||||
},
|
||||
|
||||
'getPaymentAddress': function (aCurrency, aLevel, aSubscription) {
|
||||
return this.user().connection().message('paymentAddress', { subscription:aSubscription, currency:aCurrency, level:aLevel });
|
||||
},
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
'credentialVefificationFunction': function (someCredentials) {
|
||||
var result;
|
||||
var deferredPassphrase;
|
||||
|
||||
result = false;
|
||||
|
||||
deferredPassphrase = this.user().getPassphrase();
|
||||
if (deferredPassphrase.state() == 'success') {
|
||||
result = (someCredentials['passphrase'] == deferredPassphrase.results[0]);
|
||||
}
|
||||
|
||||
result = result && (someCredentials['username'] == this.user().username());
|
||||
|
||||
return result;
|
||||
},
|
||||
|
||||
'deleteAccount': function (someCredentials) {
|
||||
if (this.credentialVefificationFunction(someCredentials)) {
|
||||
var deferredResult;
|
||||
|
||||
deferredResult = new Clipperz.Async.Deferred("AppController.deleteAccount", {trace:false});
|
||||
deferredResult.addMethod(this.user(), 'deleteAccount');
|
||||
deferredResult.addCallback(MochiKit.Signal.signal, this, 'logout');
|
||||
deferredResult.addErrback(function (anError) {
|
||||
console.log("ERROR", anError);
|
||||
});
|
||||
|
||||
deferredResult.callback();
|
||||
}
|
||||
},
|
||||
|
||||
//=============================================================================
|
||||
__syntaxFix__: "syntax fix"
|
||||
});
|
||||
|
||||
@@ -394,6 +394,9 @@ Clipperz.Base.extend(Clipperz.PM.UI.Web.Controllers.CardDialogController, Object
|
||||
|
||||
window.open(url);
|
||||
break;
|
||||
case 'BITCOIN':
|
||||
window.open(someValues['value']);
|
||||
break;
|
||||
case 'EMAIL':
|
||||
var url;
|
||||
|
||||
|
||||
@@ -190,7 +190,7 @@ MochiKit.Base.update(Clipperz.PM.UI.Web.Controllers.MainController.prototype, {
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
'handleLogout': function(anEvent) {
|
||||
this.exit('logout.html');
|
||||
this.exit('exit.html');
|
||||
},
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
@@ -320,6 +320,7 @@ MochiKit.Base.update(Clipperz.PM.UI.Web.Controllers.NewUserWizardController.prot
|
||||
|
||||
'done': function () {
|
||||
this.doneWithRuler();
|
||||
this.user().resetAllData();
|
||||
MochiKit.Signal.signal(this, 'done', {'user': this.user()});
|
||||
},
|
||||
|
||||
|
||||
@@ -0,0 +1,111 @@
|
||||
/*
|
||||
|
||||
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.Base.module('Clipperz.PM.UI.Web.Controllers');
|
||||
|
||||
Clipperz.PM.UI.Web.Controllers.PaymentController = function(args) {
|
||||
Clipperz.PM.UI.Web.Controllers.PaymentController.superclass.constructor.apply(this, arguments);
|
||||
|
||||
this._delegate = args['delegate'];
|
||||
this._referenceElement = null;
|
||||
this._paymentComponent = null;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
//MochiKit.Base.update(Clipperz.PM.UI.Web.Controllers.AppController.prototype, {
|
||||
Clipperz.Base.extend(Clipperz.PM.UI.Web.Controllers.PaymentController, Object, {
|
||||
|
||||
'toString': function() {
|
||||
return "Clipperz.PM.UI.Web.Controllers.PaymentController";
|
||||
},
|
||||
|
||||
'delegate': function () {
|
||||
return this._delegate;
|
||||
},
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
'referenceElement': function () {
|
||||
return this._referenceElement;
|
||||
},
|
||||
|
||||
'setReferenceElement': function (anElement) {
|
||||
this._referenceElement = anElement;
|
||||
},
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
'paymentComponent': function () {
|
||||
if (this._paymentComponent == null) {
|
||||
var paymentComponent = new Clipperz.PM.UI.Web.Components.PaymentComponent();
|
||||
|
||||
MochiKit.Signal.connect(paymentComponent, 'cancel', this, 'handleCancel');
|
||||
MochiKit.Signal.connect(paymentComponent, 'pay', this, 'handlePaymentRequest');
|
||||
|
||||
this._paymentComponent = paymentComponent;
|
||||
}
|
||||
|
||||
return this._paymentComponent;
|
||||
},
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
'run': function (anElement) {
|
||||
var deferredResult;
|
||||
|
||||
this.setReferenceElement(anElement);
|
||||
|
||||
deferredResult = new Clipperz.Async.Deferred("PaymentController.run", {trace:false});
|
||||
deferredResult.addMethod(this.paymentComponent(), 'deferredShowModal', {openFromElement:this.referenceElement()});
|
||||
deferredResult.addMethod(this.delegate(), 'subscriptionOptions');
|
||||
deferredResult.addMethod(this.paymentComponent(), 'setSubscriptionOptions');
|
||||
deferredResult.callback();
|
||||
|
||||
return deferredResult;
|
||||
},
|
||||
|
||||
//=============================================================================
|
||||
|
||||
'handlePaymentRequest': function (someOptions) {
|
||||
console.log("PaymentController - handlePaymentRequest", someOptions['currency'], someOptions['type']);
|
||||
var deferredResult;
|
||||
|
||||
deferredResult = new Clipperz.Async.Deferred("PaymentController.handlePaymentRequest", {trace:false});
|
||||
deferredResult.addMethod(this.delegate(), 'getPaymentSubscriptionInfo');
|
||||
deferredResult.addCallback(function (subscriptionOptions) { return subscriptionOptions['subscription']});
|
||||
deferredResult.addMethod(this.delegate(), 'getPaymentAddress', someOptions['currency'], someOptions['type']);
|
||||
deferredResult.addMethod(this.paymentComponent(), 'showQrCode');
|
||||
// deferredResult.addCallback(function (subscriptionInfo) { console.log("SUBSCRIPTION INFO", subscriptionInfo); });
|
||||
deferredResult.callback();
|
||||
|
||||
return deferredResult;
|
||||
},
|
||||
|
||||
'handleCancel': function (anEvent) {
|
||||
console.log("PaymentController - handleCancel");
|
||||
},
|
||||
|
||||
//=============================================================================
|
||||
__syntaxFix__: "syntax fix"
|
||||
});
|
||||
Reference in New Issue
Block a user