diff options
author | Azul <azul@riseup.net> | 2012-08-21 17:14:06 +0200 |
---|---|---|
committer | Azul <azul@riseup.net> | 2012-08-21 17:14:29 +0200 |
commit | d5e30a95e09bab18a55f9aad1572b6ae3e16e482 (patch) | |
tree | f2e6646a800788d8ea8ea8b531d075844d12360e /lib/plainXHR.js | |
parent | 79610eaf3c0628c8b84da3a4bbf8a6598e1a03cb (diff) |
moved on with refactoring
* srp_register now is part of srp.js
* moved server specific stuff into plainXHR (such as fetching the seed from the server)
* fixed tests
Diffstat (limited to 'lib/plainXHR.js')
-rw-r--r-- | lib/plainXHR.js | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/lib/plainXHR.js b/lib/plainXHR.js index 95ceeac..d07416b 100644 --- a/lib/plainXHR.js +++ b/lib/plainXHR.js @@ -1,3 +1,12 @@ +// +// SRP JS - Plain XHR module +// +// This is deprecated - unless you are using srp-js with the original drupal +// server side I recommend you use a different API such as restful.js +// +// This code has been largely refactored, tests are still passing but I did +// not test it with the server itself. + SRP.prototype.Remote = function() { // Perform ajax requests at the specified path, with the specified parameters @@ -78,10 +87,23 @@ SRP.prototype.Remote = function() { } return response; }; - + + // Drupal version fetches the salt from the server. No idea why but this + // should still do it. this.register = function(session, callback) { - ajaxRequest("register/salt/", "I="+session.getI(), callback); + var that = this; + ajaxRequest("register/salt/", "I="+session.getI(), receive_salt); + + function receive_salt(response) + { + if(response.salt) + { + var s = response.salt; + var v = session.getV(s); + that.sendVerifier(session, callback); + } + }; } this.sendVerifier = function(session, callback) { |