1
0
mirror of http://git.whoc.org.uk/git/password-manager.git synced 2024-11-14 18:59:03 +01:00

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; return innerDeferredResult;
}, this))); }, this)));
deferredResult.addErrbackPass(MochiKit.Base.method(this, 'deleteAllCleanTextData'));
deferredResult.releaseLock(deferredLock); deferredResult.releaseLock(deferredLock);
deferredResult.callback(); deferredResult.callback();

View File

@ -181,7 +181,7 @@ Clipperz.Base.extend(Clipperz.PM.DataModel.User, Object, {
return this._getPassphraseFunction; return this._getPassphraseFunction;
}, },
'setPassphraseFunction': function(aFunction) { 'setPassphraseFunction': function (aFunction) {
this._getPassphraseFunction = aFunction; this._getPassphraseFunction = aFunction;
}, },
@ -400,6 +400,11 @@ Clipperz.Base.extend(Clipperz.PM.DataModel.User, Object, {
], {trace:false}); ], {trace:false});
}, },
'unlock': function (aPassphraseDelegate) {
this.setPassphraseFunction(aPassphraseDelegate);
return this.getPreferences(); // TODO: make this more explicit.
},
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
'logout': function () { '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 = new Clipperz.Async.Deferred('MainController.unlock_handler', {trace:false});
deferredResult.addMethod(unlockPage, 'setProps', {'disabled': true}); deferredResult.addMethod(unlockPage, 'setProps', {'disabled': true});
deferredResult.addMethod(user, 'setPassphraseFunction', function() { return MochiKit.Async.succeed(aPassphrase); }); deferredResult.addMethod(user, 'unlock', function() { return MochiKit.Async.succeed(aPassphrase); });
deferredResult.addMethod(user, 'getPreferences'); // #ASK -> user.unlock
// deferredResult.addMethod(user, 'unlock', function() { return MochiKit.Async.succeed(aPassphrase); });
deferredResult.addErrback(function (aValue) { deferredResult.addErrback(function (aValue) {
var innerDeferredResult; var innerDeferredResult;
innerDeferredResult = new Clipperz.Async.Deferred('MainController.unlock_handler <incorrect passphrase>', {trace:false}); 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, 'setProps', {'disabled': false});
innerDeferredResult.addMethod(unlockPage, 'setInitialFocus'); innerDeferredResult.addMethod(unlockPage, 'setInitialFocus');
innerDeferredResult.addMethod(overlay, 'failed', "", 1); innerDeferredResult.addMethod(overlay, 'failed', "", 1);
@ -1195,6 +1191,7 @@ Clipperz.log("THE BROWSER IS OFFLINE");
extraProperties = { extraProperties = {
'messageBox': this.messageBoxContent(), 'messageBox': this.messageBoxContent(),
'userInfo': this.userInfo(), 'userInfo': this.userInfo(),
// 'preferences': ...
'accountInfo': this.userAccountInfo(), 'accountInfo': this.userAccountInfo(),
'selectionPanelStatus': this.isSelectionPanelOpen() ? 'OPEN' : 'CLOSED', 'selectionPanelStatus': this.isSelectionPanelOpen() ? 'OPEN' : 'CLOSED',
'settingsPanelStatus': this.isSettingsPanelOpen() ? 'OPEN' : 'CLOSED', 'settingsPanelStatus': this.isSettingsPanelOpen() ? 'OPEN' : 'CLOSED',
@ -1494,7 +1491,7 @@ Clipperz.log("THE BROWSER IS OFFLINE");
MochiKit.Base.bind(function(somePreferences) { MochiKit.Base.bind(function(somePreferences) {
return MochiKit.Base.update(this.userInfo(), {'preferences': somePreferences}) return MochiKit.Base.update(this.userInfo(), {'preferences': somePreferences})
}, this), }, this),
MochiKit.Base.bind(function(someUserInfo) { MochiKit.Base.bind(function (someUserInfo) {
this.pages()['mainPage'].setProps({ this.pages()['mainPage'].setProps({
'userInfo': someUserInfo 'userInfo': someUserInfo
}) })
@ -1507,7 +1504,6 @@ Clipperz.log("THE BROWSER IS OFFLINE");
}, },
setPreference_handler: function(aKeyPath, aValue) { setPreference_handler: function(aKeyPath, aValue) {
console.log("MainController.setPrefence", aKeyPath, aValue);
return Clipperz.Async.callbacks("MainController.setPreference_handler", [ return Clipperz.Async.callbacks("MainController.setPreference_handler", [
MochiKit.Base.method(this.overlay(), 'show', "", true), MochiKit.Base.method(this.overlay(), 'show', "", true),
MochiKit.Base.method(this.user(), 'setPreference', aKeyPath, aValue), MochiKit.Base.method(this.user(), 'setPreference', aKeyPath, aValue),