summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAzul <azul@riseup.net>2012-10-15 11:10:35 +0200
committerAzul <azul@riseup.net>2012-10-15 11:10:35 +0200
commit09a6d9eb8d0467f311bbae3d6fe2d923244edb21 (patch)
tree900cb699aaead6d43c25afd13e773671aa948f6e /src
parent2263abad65b92ef26c8e67097bbcfeb6988ab8fd (diff)
all rest tests passing, using proper verbs
Diffstat (limited to 'src')
-rw-r--r--src/jqueryRest.js21
1 files changed, 9 insertions, 12 deletions
diff --git a/src/jqueryRest.js b/src/jqueryRest.js
index 64c8080..f50080b 100644
--- a/src/jqueryRest.js
+++ b/src/jqueryRest.js
@@ -1,12 +1,5 @@
jqueryRest = function() {
- // Perform ajax requests at the specified path, with the specified parameters
- // Calling back the specified function.
- function ajaxRequest(relative_path, params, callback)
- {
- $.post(relative_path, params, callback)
- }
-
function parseResponse() {
if (responseIsXML()) {
return parseXML(xhr.responseXML);
@@ -61,7 +54,7 @@ jqueryRest = function() {
function sendVerifier(session, callback) {
var salt = session.getSalt();
- ajaxRequest("users", { user:
+ $.post("users", { user:
{ login: session.getI(),
password_salt: salt,
password_verifier: session.getV(salt).toString(16)}
@@ -69,16 +62,20 @@ jqueryRest = function() {
}
function handshake(session, callback) {
- ajaxRequest("sessions", { login: session.getI(),
+ $.post("sessions", { login: session.getI(),
A: session.getAstr()}, callback);
}
- function authenticate(session, callback) {
- ajaxRequest("sessions/" + session.getI(), {client_auth: session.getM()}, callback);
+ function authenticate(session, success) {
+ $.ajax({
+ url: "sessions/" + session.getI(),
+ type: 'PUT',
+ data: {client_auth: session.getM()},
+ success: success
+ });
}
return {
- ajaxRequest: ajaxRequest,
register: register,
register_send_verifier: sendVerifier,
handshake: handshake,