diff options
author | Azul <azul@leap.se> | 2012-07-02 14:26:44 +0200 |
---|---|---|
committer | Azul <azul@leap.se> | 2012-07-02 14:26:44 +0200 |
commit | 6bb45b271def50935bea8869ccb39c35c0c725be (patch) | |
tree | 4827cf655b53435f62bb8657044e3c5e80ca1175 /javascript/srp_register.js | |
parent | f2930d4f6f0310a4e764e58cd5ef3dc674d11e14 (diff) |
factored out parsing the responses
Diffstat (limited to 'javascript/srp_register.js')
-rw-r--r-- | javascript/srp_register.js | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/javascript/srp_register.js b/javascript/srp_register.js index ffadf81..053c4e4 100644 --- a/javascript/srp_register.js +++ b/javascript/srp_register.js @@ -12,19 +12,18 @@ function SRP_REGISTER() }; // Receive the salt for registration - SRP.prototype.register_receive_salt = function() + SRP.prototype.register_receive_salt = function(response) { - var xhr = that.getxhr(); - if(xhr.responseXML.getElementsByTagName("salt").length > 0) + if(response.salt) { - var s = that.innerxml(xhr.responseXML.getElementsByTagName("salt")[0]); + var s = response.salt; var x = that.calcX(s); var v = that.getg().modPow(x, that.getN()); that.register_send_verifier(v.toString(16)); } - else if(xhr.responseXML.getElementsByTagName("error").length > 0) + else if(response.error) { - that.error_message(that.innerxml(xhr.responseXML.getElementsByTagName("error")[0])); + that.error_message(response.error); } }; // Send the verifier to the server @@ -36,10 +35,9 @@ function SRP_REGISTER() }; // The user has been registered successfully, now login - SRP.prototype.register_user = function() + SRP.prototype.register_user = function(response) { - var xhr = that.getxhr(); - if(xhr.responseXML.getElementsByTagName("ok").length > 0) + if(response.ok) { that.identify(); } |