X-Git-Url: http://git.bytex64.net/?a=blobdiff_plain;f=www%2Fjssrc%2Fblerg%2FAPI.js;h=4a0602bff9654265c2f7e03b61ec212f4338b8fe;hb=2d498144a3a655c1fd4e54b9e9d61d1c3eb82206;hp=a5aa965100ab75fd91bc344cec2329f4a0fe950f;hpb=79a8b4304e691959e39d24fe9438d73bcea1badf;p=blerg.git diff --git a/www/jssrc/blerg/API.js b/www/jssrc/blerg/API.js index a5aa965..4a0602b 100644 --- a/www/jssrc/blerg/API.js +++ b/www/jssrc/blerg/API.js @@ -88,6 +88,24 @@ enyo.kind({ }); enyo.setCookie('username', '', {"Max-Age": 0}); }, + changePassword: function(oldpassword, newpassword) { + var req = new enyo.Ajax({ + url: baseURL + '/passwd', + method: 'POST' + }); + req.response(function(inSender, inResponse) { + if (inResponse.status == 'success') { + this.bubble('onPasswordChangeSuccessful'); + } else { + this.bubble('onPasswordChangeFailed'); + } + }.bind(this)); + req.go({ + username: blerg.API.username, + password: oldpassword, + new_password: newpassword + }); + }, loadUserRecords: function(username, from ,to) { var url; if (from != undefined && to != undefined) { @@ -222,4 +240,27 @@ enyo.kind({ username: blerg.API.username }); }, + post: function(data) { + var req = new enyo.Ajax({ + url: baseURL + '/put', + method: 'POST' + }); + req.response(function(inSender, inResponse) { + if (inResponse && inResponse.status == 'success') { + this.bubble('onPostSuccessful', { + username: blerg.API.username, + data: data + }); + } else { + this.bubble('onPostFailed', { + username: blerg.API.username, + data: data + }); + } + }.bind(this)); + req.go({ + username: blerg.API.username, + data: data + }); + } });