summaryrefslogtreecommitdiff
path: root/lib/plainXHR.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/plainXHR.js')
-rw-r--r--lib/plainXHR.js26
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) {