Injected the username when password has changed. (#3033)

* 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.

* Update unit test for password_reset_success redirect
This commit is contained in:
Halim Qarroum
2016-11-10 18:40:17 +01:00
committed by Florent Vilmart
parent bb9ce773bb
commit 9abf17730f
2 changed files with 3 additions and 2 deletions

View File

@@ -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');

View File

@@ -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})