Skip to content

Commit 9abf177

Browse files
HQarroumflovilmart
authored andcommitted
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
1 parent bb9ce77 commit 9abf177

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

spec/ValidationAndPasswordsReset.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -816,7 +816,7 @@ describe("Custom Pages, Email Verification, Password Reset", () => {
816816
return;
817817
}
818818
expect(response.statusCode).toEqual(302);
819-
expect(response.body).toEqual('Found. Redirecting to http://localhost:8378/1/apps/password_reset_success.html');
819+
expect(response.body).toEqual('Found. Redirecting to http://localhost:8378/1/apps/password_reset_success.html?username=zxcv');
820820

821821
Parse.User.logIn("zxcv", "hello").then(function(user){
822822
let config = new Config('test');

src/Routers/PublicAPIRouter.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,10 @@ export class PublicAPIRouter extends PromiseRouter {
102102
}
103103

104104
return config.userController.updatePassword(username, token, new_password).then((result) => {
105+
let params = qs.stringify({username: username});
105106
return Promise.resolve({
106107
status: 302,
107-
location: config.passwordResetSuccessURL
108+
location: `${config.passwordResetSuccessURL}?${params}`
108109
});
109110
}, (err) => {
110111
let params = qs.stringify({username: username, token: token, id: config.applicationId, error:err, app:config.appName})

0 commit comments

Comments
 (0)