Cleaned’ up user unlock feature

This commit is contained in:
Giulio Cesare Solaroli 2015-09-23 13:43:59 +02:00
parent 7ca31faa28
commit 6ad0024600
3 changed files with 10 additions and 8 deletions

View File

@ -275,6 +275,7 @@ Clipperz.PM.DataModel.EncryptedRemoteObject.prototype = MochiKit.Base.update(nul
return innerDeferredResult;
}, this)));
deferredResult.addErrbackPass(MochiKit.Base.method(this, 'deleteAllCleanTextData'));
deferredResult.releaseLock(deferredLock);
deferredResult.callback();

View File

@ -400,6 +400,11 @@ Clipperz.Base.extend(Clipperz.PM.DataModel.User, Object, {
], {trace:false});
},
'unlock': function (aPassphraseDelegate) {
this.setPassphraseFunction(aPassphraseDelegate);
return this.getPreferences(); // TODO: make this more explicit.
},
//-------------------------------------------------------------------------
'logout': function () {

View File

@ -422,15 +422,11 @@ Clipperz.log("THE BROWSER IS OFFLINE");
deferredResult = new Clipperz.Async.Deferred('MainController.unlock_handler', {trace:false});
deferredResult.addMethod(unlockPage, 'setProps', {'disabled': true});
deferredResult.addMethod(user, 'setPassphraseFunction', function() { return MochiKit.Async.succeed(aPassphrase); });
deferredResult.addMethod(user, 'getPreferences'); // #ASK -> user.unlock
// deferredResult.addMethod(user, 'unlock', function() { return MochiKit.Async.succeed(aPassphrase); });
deferredResult.addMethod(user, 'unlock', function() { return MochiKit.Async.succeed(aPassphrase); });
deferredResult.addErrback(function (aValue) {
var innerDeferredResult;
innerDeferredResult = new Clipperz.Async.Deferred('MainController.unlock_handler <incorrect passphrase>', {trace:false});
innerDeferredResult.addMethod(user, 'getHeaderIndex', 'preferences');
innerDeferredResult.addMethodcaller('deleteAllCleanTextData');
innerDeferredResult.addMethod(unlockPage, 'setProps', {'disabled': false});
innerDeferredResult.addMethod(unlockPage, 'setInitialFocus');
innerDeferredResult.addMethod(overlay, 'failed', "", 1);
@ -1195,6 +1191,7 @@ Clipperz.log("THE BROWSER IS OFFLINE");
extraProperties = {
'messageBox': this.messageBoxContent(),
'userInfo': this.userInfo(),
// 'preferences': ...
'accountInfo': this.userAccountInfo(),
'selectionPanelStatus': this.isSelectionPanelOpen() ? 'OPEN' : 'CLOSED',
'settingsPanelStatus': this.isSettingsPanelOpen() ? 'OPEN' : 'CLOSED',
@ -1507,7 +1504,6 @@ Clipperz.log("THE BROWSER IS OFFLINE");
},
setPreference_handler: function(aKeyPath, aValue) {
console.log("MainController.setPrefence", aKeyPath, aValue);
return Clipperz.Async.callbacks("MainController.setPreference_handler", [
MochiKit.Base.method(this.overlay(), 'show', "", true),
MochiKit.Base.method(this.user(), 'setPreference', aKeyPath, aValue),