summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAzul <azul@riseup.net>2012-11-20 10:52:45 +0100
committerAzul <azul@riseup.net>2012-11-20 10:52:45 +0100
commitcb46537c98db3cb7ac8cf23de243a86aa4a36acd (patch)
tree63cba32a93535d5cfe776d5fc0861f7ba3dcff6f /src
parent555491c4420a3b8b23b74fb081b76a5bf7778049 (diff)
sending the parsed json object to the error handler
Diffstat (limited to 'src')
-rw-r--r--src/jqueryRest.js12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/jqueryRest.js b/src/jqueryRest.js
index c439f67..c4b0161 100644
--- a/src/jqueryRest.js
+++ b/src/jqueryRest.js
@@ -29,13 +29,13 @@ srp.remote = (function(){
function signup(){
jqueryRest.register(srp.session)
.success(srp.signedUp)
- .error(srp.error)
+ .error(error)
};
function login(){
jqueryRest.handshake(srp.session)
.success(receiveSalts)
- .error(srp.error)
+ .error(error)
};
function receiveSalts(response){
@@ -52,7 +52,7 @@ srp.remote = (function(){
srp.session.calculations(response.salt, response.B);
jqueryRest.authenticate(srp.session)
.success(confirmAuthentication)
- .error(srp.error);
+ .error(error);
}
};
@@ -66,6 +66,12 @@ srp.remote = (function(){
srp.error("Server key does not match");
};
+ // The server will send error messages as json alongside
+ // the http error response.
+ function error(xhr)
+ {
+ srp.error($.parseJSON(xhr.responseText))
+ };
return {
signup: signup,