author | Clipperz <info@clipperz.com> | 2013-01-08 15:21:04 (UTC) |
---|---|---|
committer | Clipperz <info@clipperz.com> | 2013-01-08 15:21:04 (UTC) |
commit | 816fc35420a434b1d54ae5833d617608f7456048 (patch) (unidiff) | |
tree | 95b8caf354083593d7775e4dda6f4c556b44a2d9 /frontend/gamma/js/Clipperz/PM/Connection.js | |
parent | 267603e3aa3cf0029411e67ae14018b52344c296 (diff) | |
download | clipperz-816fc35420a434b1d54ae5833d617608f7456048.zip clipperz-816fc35420a434b1d54ae5833d617608f7456048.tar.gz clipperz-816fc35420a434b1d54ae5833d617608f7456048.tar.bz2 |
Updated version of /gamma
Tons of changes, included a new draft of the mobile version (still VERY rough)
Diffstat (limited to 'frontend/gamma/js/Clipperz/PM/Connection.js') (more/less context) (ignore whitespace changes)
-rw-r--r-- | frontend/gamma/js/Clipperz/PM/Connection.js | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/frontend/gamma/js/Clipperz/PM/Connection.js b/frontend/gamma/js/Clipperz/PM/Connection.js index b4e8aaa..a05a310 100644 --- a/frontend/gamma/js/Clipperz/PM/Connection.js +++ b/frontend/gamma/js/Clipperz/PM/Connection.js | |||
@@ -42,4 +42,5 @@ Clipperz.PM.Connection = function (args) { | |||
42 | this._connectionId = null; | 42 | this._connectionId = null; |
43 | this._sharedSecret = null; | 43 | this._sharedSecret = null; |
44 | this._serverLockValue = null; | ||
44 | 45 | ||
45 | return this; | 46 | return this; |
@@ -147,4 +148,14 @@ MochiKit.Logging.logError("### Connection.defaultErrorHandler: " + anErrorString | |||
147 | }, | 148 | }, |
148 | 149 | ||
150 | //------------------------------------------------------------------------- | ||
151 | |||
152 | 'serverLockValue': function () { | ||
153 | return this._serverLockValue; | ||
154 | }, | ||
155 | |||
156 | 'setServerLockValue': function (aValue) { | ||
157 | this._serverLockValue = aValue; | ||
158 | }, | ||
159 | |||
149 | //========================================================================= | 160 | //========================================================================= |
150 | /* | 161 | /* |
@@ -321,5 +332,5 @@ Clipperz.PM.Connection.SRP['1.0'].prototype = MochiKit.Base.update(new Clipperz. | |||
321 | }, | 332 | }, |
322 | 333 | ||
323 | 'login': function(/*anUsername, aPassphrase*/) { | 334 | 'login': function(isReconnecting) { |
324 | vardeferredResult; | 335 | vardeferredResult; |
325 | var cryptoVersion; | 336 | var cryptoVersion; |
@@ -327,5 +338,4 @@ Clipperz.PM.Connection.SRP['1.0'].prototype = MochiKit.Base.update(new Clipperz. | |||
327 | 338 | ||
328 | cryptoVersion = this.clipperz_pm_crypto_version(); | 339 | cryptoVersion = this.clipperz_pm_crypto_version(); |
329 | |||
330 | deferredResult = new Clipperz.Async.Deferred("Connection.login", {trace:false}); | 340 | deferredResult = new Clipperz.Async.Deferred("Connection.login", {trace:false}); |
331 | deferredResult.addCallback(this.getCredentialsFunction()); | 341 | deferredResult.addCallback(this.getCredentialsFunction()); |
@@ -400,4 +410,11 @@ Clipperz.PM.Connection.SRP['1.0'].prototype = MochiKit.Base.update(new Clipperz. | |||
400 | /// ?? result = this.user().oneTimePasswordManager().archiveOneTimePassword(this.oneTimePassword())); | 410 | /// ?? result = this.user().oneTimePasswordManager().archiveOneTimePassword(this.oneTimePassword())); |
401 | // } | 411 | // } |
412 | |||
413 | if ((isReconnecting == true) && (this.serverLockValue() != someParameters['lock'])) { | ||
414 | throw Clipperz.PM.Connection.exception.StaleData; | ||
415 | } else { | ||
416 | this.setServerLockValue(someParameters['lock']); | ||
417 | } | ||
418 | |||
402 | return someParameters; | 419 | return someParameters; |
403 | }, this)); | 420 | }, this)); |
@@ -430,4 +447,10 @@ Clipperz.PM.Connection.SRP['1.0'].prototype = MochiKit.Base.update(new Clipperz. | |||
430 | 'message': function(aMessageName, someParameters) { | 447 | 'message': function(aMessageName, someParameters) { |
431 | var args; | 448 | var args; |
449 | var parameters; | ||
450 | |||
451 | parameters = someParameters || {}; | ||
452 | if (typeof(parameters['user']) != 'undefined') { | ||
453 | parameters['user']['lock'] = this.serverLockValue(); | ||
454 | } | ||
432 | 455 | ||
433 | //console.log(">>> Connection.message", aMessageName, someParameters); | 456 | //console.log(">>> Connection.message", aMessageName, someParameters); |
@@ -435,5 +458,6 @@ Clipperz.PM.Connection.SRP['1.0'].prototype = MochiKit.Base.update(new Clipperz. | |||
435 | message: aMessageName, | 458 | message: aMessageName, |
436 | srpSharedSecret: this.sharedSecret(), | 459 | srpSharedSecret: this.sharedSecret(), |
437 | parameters: (someParameters || {}) | 460 | // parameters: (someParameters || {}) |
461 | parameters: parameters | ||
438 | } | 462 | } |
439 | 463 | ||
@@ -450,6 +474,5 @@ Clipperz.PM.Connection.SRP['1.0'].prototype = MochiKit.Base.update(new Clipperz. | |||
450 | deferredResult.addCallback(MochiKit.Base.bind(function(res) { | 474 | deferredResult.addCallback(MochiKit.Base.bind(function(res) { |
451 | if (typeof(res['lock']) != 'undefined') { | 475 | if (typeof(res['lock']) != 'undefined') { |
452 | //TODO: ????? | 476 | this.setServerLockValue(res['lock']); |
453 | // ?? this.user().setLock(res['lock']); | ||
454 | } | 477 | } |
455 | return res; | 478 | return res; |
@@ -588,4 +611,5 @@ Clipperz.PM.Connection.SRP['1.1'].prototype = MochiKit.Base.update(new Clipperz. | |||
588 | Clipperz.PM.Connection.exception = { | 611 | Clipperz.PM.Connection.exception = { |
589 | WrongChecksum: new MochiKit.Base.NamedError("Clipperz.ByteArray.exception.InvalidValue"), | 612 | WrongChecksum: new MochiKit.Base.NamedError("Clipperz.ByteArray.exception.InvalidValue"), |
613 | StaleData: new MochiKit.Base.NamedError("Stale data"), | ||
590 | UnexpectedRequest:new MochiKit.Base.NamedError("Clipperz.ByteArray.exception.UnexpectedRequest") | 614 | UnexpectedRequest:new MochiKit.Base.NamedError("Clipperz.ByteArray.exception.UnexpectedRequest") |
591 | }; | 615 | }; |