From 3c55c67b84c5da1b98f2cb6199d87d3226ae3e04 Mon Sep 17 00:00:00 2001 From: Halim Qarroum Date: Thu, 10 Nov 2016 14:41:13 +0100 Subject: [PATCH 1/2] Injected the username when password has changed. When the resetPassword controller has successfully updated the user's password, it now redirects the user to the password changed page with the username as a query parameters. --- src/Routers/PublicAPIRouter.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Routers/PublicAPIRouter.js b/src/Routers/PublicAPIRouter.js index 31e110351b..efad908762 100644 --- a/src/Routers/PublicAPIRouter.js +++ b/src/Routers/PublicAPIRouter.js @@ -102,9 +102,10 @@ export class PublicAPIRouter extends PromiseRouter { } return config.userController.updatePassword(username, token, new_password).then((result) => { + let params = qs.stringify({username: username}); return Promise.resolve({ status: 302, - location: config.passwordResetSuccessURL + location: `${config.passwordResetSuccessURL}?${params}` }); }, (err) => { let params = qs.stringify({username: username, token: token, id: config.applicationId, error:err, app:config.appName}) From bb2932bb3091ba7e4ed4ae9af036db0a2f7e2c34 Mon Sep 17 00:00:00 2001 From: Halim Qarroum Date: Thu, 10 Nov 2016 15:09:55 +0100 Subject: [PATCH 2/2] Update unit test for password_reset_success redirect --- spec/ValidationAndPasswordsReset.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/ValidationAndPasswordsReset.spec.js b/spec/ValidationAndPasswordsReset.spec.js index 62ed514e05..04dad59d25 100644 --- a/spec/ValidationAndPasswordsReset.spec.js +++ b/spec/ValidationAndPasswordsReset.spec.js @@ -816,7 +816,7 @@ describe("Custom Pages, Email Verification, Password Reset", () => { return; } expect(response.statusCode).toEqual(302); - expect(response.body).toEqual('Found. Redirecting to http://localhost:8378/1/apps/password_reset_success.html'); + expect(response.body).toEqual('Found. Redirecting to http://localhost:8378/1/apps/password_reset_success.html?username=zxcv'); Parse.User.logIn("zxcv", "hello").then(function(user){ let config = new Config('test');