From 83563a23fe5a542c4485635d7658115defb831fd Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Thu, 16 Jul 2015 09:50:12 +0100 Subject: [PATCH 1/3] Implement setPassword API --- lib/client.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/lib/client.js b/lib/client.js index 4b5575a5d..754deeac9 100644 --- a/lib/client.js +++ b/lib/client.js @@ -806,6 +806,25 @@ MatrixClient.prototype.addThreePid = function(creds, bind, callback) { ); }; +/** + * @param {Object} auth_dict + * @param {string} new_password + * @param {module:client.callback} callback Optional. + * @return {module:client.Promise} Resolves: TODO + * @return {module:http-api.MatrixError} Rejects: with an error response. + */ +MatrixClient.prototype.setPassword = function(auth_dict, new_password, callback) { + var path = "/account/password"; + var data = { + 'auth': auth_dict, + 'new_password': new_password, + }; + + return this._http.authedRequestWithPrefix( + callback, "POST", path, null, data, httpApi.PREFIX_V2_ALPHA + ); +}; + /** * @param {string} presence * @param {module:client.callback} callback Optional. From ec5352183a61e48c6728a721b4e7ae57731dc8ce Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Thu, 16 Jul 2015 09:56:36 +0100 Subject: [PATCH 2/3] Camel case --- lib/client.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/client.js b/lib/client.js index 754deeac9..28078adda 100644 --- a/lib/client.js +++ b/lib/client.js @@ -807,17 +807,17 @@ MatrixClient.prototype.addThreePid = function(creds, bind, callback) { }; /** - * @param {Object} auth_dict - * @param {string} new_password + * @param {Object} authDict + * @param {string} newPassword * @param {module:client.callback} callback Optional. * @return {module:client.Promise} Resolves: TODO * @return {module:http-api.MatrixError} Rejects: with an error response. */ -MatrixClient.prototype.setPassword = function(auth_dict, new_password, callback) { +MatrixClient.prototype.setPassword = function(authDict, newPassword, callback) { var path = "/account/password"; var data = { - 'auth': auth_dict, - 'new_password': new_password, + 'auth': authDict, + 'new_password': newPassword, }; return this._http.authedRequestWithPrefix( From ebb21f56d3def9fba8e8148ffaaaa5329edc9a15 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Thu, 16 Jul 2015 09:58:18 +0100 Subject: [PATCH 3/3] No trailing commas :( --- lib/client.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/client.js b/lib/client.js index 28078adda..a25348d1d 100644 --- a/lib/client.js +++ b/lib/client.js @@ -817,7 +817,7 @@ MatrixClient.prototype.setPassword = function(authDict, newPassword, callback) { var path = "/account/password"; var data = { 'auth': authDict, - 'new_password': newPassword, + 'new_password': newPassword }; return this._http.authedRequestWithPrefix(