Fixed lock/unlock issue and removed console.log

This commit is contained in:
Giulio Cesare Solaroli 2015-10-27 14:31:39 +01:00
parent e3c386497f
commit 8608fb4253
No known key found for this signature in database
GPG Key ID: 22E34C908F02CBA2
6 changed files with 25 additions and 17 deletions

View File

@ -581,7 +581,7 @@ Clipperz.Base.extend(Clipperz.PM.DataModel.Record, Clipperz.PM.DataModel.Encrypt
result = someFilteredResults[0];
break;
default:
console.log("Warning: Record.fieldWithLabel('" + aLabel + "') is returning more than one result: " + someFilteredResults.length);
Clipperz.log("Warning: Record.fieldWithLabel('" + aLabel + "') is returning more than one result: " + someFilteredResults.length);
result = someFilteredResults[0];
break;
}
@ -607,7 +607,7 @@ console.log("Warning: Record.fieldWithLabel('" + aLabel + "') is returning more
var transientStateKey;
if (typeof(aVersionReference) == 'undefined') {
console.log("ERROR; getVersionKey aVersionReference is undefined");
Clipperz.log("ERROR; getVersionKey aVersionReference is undefined");
}
transientStateKey = 'versionKeys' + '.' + aVersionReference;

View File

@ -695,7 +695,7 @@ Clipperz.Base.extend(Clipperz.PM.DataModel.User, Object, {
result = someFilteredResults[0];
break;
default:
console.log("Warning: User.recordWithLabel('" + aLabel + "') is returning more than one result: " + someFilteredResults.length);
Clipperz.log("Warning: User.recordWithLabel('" + aLabel + "') is returning more than one result: " + someFilteredResults.length);
result = someFilteredResults[0];
break;
}

View File

@ -295,7 +295,7 @@ Clipperz.Base.extend(Clipperz.PM.Proxy.Offline.DataStore, Object, {
's': someParameters['credentials']['s'],
'v': someParameters['credentials']['v'],
'version': someParameters['credentials']['version'],
// 'lock': Clipperz.Crypto.Base.generateRandomSeed(),
'lock': Clipperz.PM.Crypto.randomKey(),
'userDetails': someParameters['user']['header'],
'statistics': someParameters['user']['statistics'],
'userDetailsVersion': someParameters['user']['version'],

View File

@ -63,7 +63,6 @@ Clipperz.PM.UI.Components.Cards.TextAreaClass = React.createClass({
handleKeyDown: function (anEvent) {
switch (anEvent.keyCode) {
case 27: // escape
console.log("ESCAPE");
Mousetrap.trigger('esc');
break;
}

View File

@ -424,19 +424,27 @@ Clipperz.log("THE BROWSER IS OFFLINE");
unlock_handler: function(aCredential, aCredentialType) {
var deferredResult;
var passphrase;
var user, passphrase, getPassphraseDelegate;
var user = this.user();
// var user = this.user();
var oldUser = this.user();
var unlockPage = this.pages()['unlockPage'];
var overlay = this.overlay();
overlay.show("validating…");
passphrase = (aCredentialType=='PIN') ? Clipperz.PM.PIN.credentialsWithPIN(aCredential)['passphrase'] : aCredential;
deferredResult = new Clipperz.Async.Deferred('MainController.unlock_handler', {trace:false});
getPassphraseDelegate = MochiKit.Base.partial(MochiKit.Async.succeed, passphrase);
user = new Clipperz.PM.DataModel.User({'username':oldUser.username(), 'getPassphraseFunction':getPassphraseDelegate});
deferredResult = new Clipperz.Async.Deferred('MainController.unlock_handler', {trace:true});
deferredResult.addMethod(unlockPage, 'setProps', {'disabled': true});
deferredResult.addMethod(user, 'unlock', function() { return MochiKit.Async.succeed(passphrase); });
deferredResult.addMethod(user, 'login');
deferredResult.addMethod(this, 'setUser', user);
// deferredResult.addMethod(user, 'unlock', MochiKit.Base.partial(MochiKit.Async.succeed, passphrase));
deferredResult.addErrback(MochiKit.Base.bind(function (aValue) {
var innerDeferredResult;
var errorMessage;

View File

@ -1893,18 +1893,19 @@ var tests = {
SimpleTest.is(MochiKit.Base.keys(someDirectLogins).length, 22, "The user has 22 direct logins");
});
deferredResult.addMethod(proxy, 'shouldNotReceiveAnyFurtherRequest');
deferredResult.addCallback(function () { currentPasswordFunction = failPassword; });
// User.lock() actually sends a `logout` request.
// deferredResult.addMethod(proxy, 'shouldNotReceiveAnyFurtherRequest');
// deferredResult.addCallback(function () { currentPasswordFunction = failPassword; });
deferredResult.addMethod(user, 'lock');
deferredResult.shouldSucceed("Locking out should not trigger an exception");
deferredResult.addMethod(proxy, 'unexpectedRequests');
deferredResult.addCallback(MochiKit.Base.itemgetter('length'));
deferredResult.addTest(0, "The proxy should have not received any extra request");
//deferredResult.addCallback(function (aValue) { console.log("PROXY.unexpectedRequests", Clipperz.Base.serializeJSON(proxy.unexpectedRequests())); return aValue; });
deferredResult.addMethod(proxy, 'mayReceiveMoreRequests');
deferredResult.addCallback(function () { currentPasswordFunction = returnPassword; });
// deferredResult.addMethod(proxy, 'unexpectedRequests');
// deferredResult.addCallback(MochiKit.Base.itemgetter('length'));
// deferredResult.addTest(0, "The proxy should have not received any extra request");
// deferredResult.addCallback(function (aValue) { console.log("PROXY.unexpectedRequests", Clipperz.Base.serializeJSON(proxy.unexpectedRequests())); return aValue; });
// deferredResult.addMethod(proxy, 'mayReceiveMoreRequests');
// deferredResult.addCallback(function () { currentPasswordFunction = returnPassword; });
deferredResult.callback();