diff options
Diffstat (limited to 'lib/srp_register.js')
-rw-r--r-- | lib/srp_register.js | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/lib/srp_register.js b/lib/srp_register.js index 1666476..8365fed 100644 --- a/lib/srp_register.js +++ b/lib/srp_register.js @@ -5,10 +5,8 @@ function SRP_REGISTER() // Initiate the registration process SRP.prototype.register = function() { - that = this; - var handshake_url = this.geturl() + this.paths("register/salt/"); - var params = "I="+this.getI(); - this.ajaxRequest(handshake_url, params, this.register_receive_salt); + session = this; + this.remote.register(this.getI(), session.register_receive_salt); }; // Receive the salt for registration @@ -17,28 +15,20 @@ function SRP_REGISTER() if(response.salt) { var s = response.salt; - var v = that.calcV(s); - that.register_send_verifier(v.toString(16)); + var v = session.calcV(s); + session.remote.register_send_verifier(v.toString(16), session.registered_user); } else if(response.error) { - that.error_message(response.error); + session.error_message(response.error); } }; - // Send the verifier to the server - SRP.prototype.register_send_verifier = function(v) - { - var params = "v="+v; - var auth_url = that.geturl() + that.paths("register/user/"); - that.ajaxRequest(auth_url, params, that.registered_user); - }; - // The user has been registered successfully, now login SRP.prototype.registered_user = function(response) { if(response.ok) { - that.identify(); + session.identify(); } }; }; |