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 | |||
@@ -43,2 +43,3 @@ Clipperz.PM.Connection = function (args) { | |||
43 | this._sharedSecret = null; | 43 | this._sharedSecret = null; |
44 | this._serverLockValue = null; | ||
44 | 45 | ||
@@ -148,2 +149,12 @@ MochiKit.Logging.logError("### Connection.defaultErrorHandler: " + anErrorString | |||
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 | //========================================================================= |
@@ -322,3 +333,3 @@ Clipperz.PM.Connection.SRP['1.0'].prototype = MochiKit.Base.update(new Clipperz. | |||
322 | 333 | ||
323 | 'login': function(/*anUsername, aPassphrase*/) { | 334 | 'login': function(isReconnecting) { |
324 | vardeferredResult; | 335 | vardeferredResult; |
@@ -328,3 +339,2 @@ Clipperz.PM.Connection.SRP['1.0'].prototype = MochiKit.Base.update(new Clipperz. | |||
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}); |
@@ -401,2 +411,9 @@ Clipperz.PM.Connection.SRP['1.0'].prototype = MochiKit.Base.update(new Clipperz. | |||
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; |
@@ -431,2 +448,8 @@ Clipperz.PM.Connection.SRP['1.0'].prototype = MochiKit.Base.update(new Clipperz. | |||
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 | ||
@@ -436,3 +459,4 @@ Clipperz.PM.Connection.SRP['1.0'].prototype = MochiKit.Base.update(new Clipperz. | |||
436 | srpSharedSecret: this.sharedSecret(), | 459 | srpSharedSecret: this.sharedSecret(), |
437 | parameters: (someParameters || {}) | 460 | // parameters: (someParameters || {}) |
461 | parameters: parameters | ||
438 | } | 462 | } |
@@ -451,4 +475,3 @@ Clipperz.PM.Connection.SRP['1.0'].prototype = MochiKit.Base.update(new Clipperz. | |||
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 | } |
@@ -589,2 +612,3 @@ 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") |