From 42b4cef4b6aa2078ea518e13abc009f456763b66 Mon Sep 17 00:00:00 2001 From: Salla Karppinen Date: Mon, 29 May 2017 12:00:19 +0100 Subject: [PATCH 1/3] release 13.0.1-1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 85cf9e1..5905150 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "oae-rest", "main": "./lib/api.js", "description": "Open Academic Environment (OAE) REST client library", - "version": "12.6.0", + "version": "13.0.1-1", "homepage": "http://www.oaeproject.org", "author": { "name": "The Apereo Foundation", From 1655e7a0494745f41cb29f24113c5fe92039fd38 Mon Sep 17 00:00:00 2001 From: Salla Karppinen Date: Tue, 20 Jun 2017 09:08:36 +0100 Subject: [PATCH 2/3] Added password reset features for test --- lib/api.authentication.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/lib/api.authentication.js b/lib/api.authentication.js index 39bde26..b6ecfca 100644 --- a/lib/api.authentication.js +++ b/lib/api.authentication.js @@ -289,3 +289,29 @@ var shibbolethTenantCallback = module.exports.shibbolethTenantCallback = functio var ldapLogin = module.exports.ldapLogin = function(restCtx, username, password, callback) { RestUtil.RestRequest(restCtx, '/api/auth/ldap', 'POST', {'username': username, 'password': password}, callback); }; + +/** + * Get a secret token to be used to reset password + * + * @param {RestContext} restCtx Standard REST Context object that contains the current tenant URL + * @param {String} username The username for which a password needs to be reset + * @param {Function} callback Standard callback method + * @param {Object} callback.err An error that occurred, if any + */ +var getResetPasswordSecret = module.exports.getResetPasswordSecret = function(restCtx, username, callback) { + RestUtil.RestRequest(restCtx, '/api/auth/local/reset/init/' + username, 'GET', null, callback); +}; + +/** + * Reset a password for a user using a token + * + * @param {RestContext} restCtx Standard REST Context object that contains the current tenant URL + * @param {String} username The username for which a password needs to be reset + * @param {String} secret The token identifying the user trying to reset their password + * @param {String} newPassword The new password to reset + * @param {Function} callback Standard callback method + * @param {Object} callback.err An error that occurred, if any + */ +var resetPassword = module.exports.resetPassword = function(restCtx, username, secret, newPassword, callback) { + RestUtil.RestRequest(restCtx, '/api/auth/local/reset/change/' + username, 'POST', {'secret': secret, 'newPassword': newPassword}, callback); +}; From 2470b8f731eef62701c10a1f182d1ad631d0fac3 Mon Sep 17 00:00:00 2001 From: Salla Karppinen Date: Tue, 20 Jun 2017 11:13:45 +0100 Subject: [PATCH 3/3] Changed path --- lib/api.authentication.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/api.authentication.js b/lib/api.authentication.js index b6ecfca..44acfb8 100644 --- a/lib/api.authentication.js +++ b/lib/api.authentication.js @@ -299,7 +299,7 @@ var ldapLogin = module.exports.ldapLogin = function(restCtx, username, password, * @param {Object} callback.err An error that occurred, if any */ var getResetPasswordSecret = module.exports.getResetPasswordSecret = function(restCtx, username, callback) { - RestUtil.RestRequest(restCtx, '/api/auth/local/reset/init/' + username, 'GET', null, callback); + RestUtil.RestRequest(restCtx, '/api/auth/local/reset/secret/' + username, 'GET', null, callback); }; /** @@ -313,5 +313,5 @@ var getResetPasswordSecret = module.exports.getResetPasswordSecret = function(re * @param {Object} callback.err An error that occurred, if any */ var resetPassword = module.exports.resetPassword = function(restCtx, username, secret, newPassword, callback) { - RestUtil.RestRequest(restCtx, '/api/auth/local/reset/change/' + username, 'POST', {'secret': secret, 'newPassword': newPassword}, callback); + RestUtil.RestRequest(restCtx, '/api/auth/local/reset/password/' + username, 'POST', {'secret': secret, 'newPassword': newPassword}, callback); };