Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow configurable password reset URL #6838

Open
tedraykov opened this issue May 15, 2023 · 1 comment · May be fixed by #6839
Open

Allow configurable password reset URL #6838

tedraykov opened this issue May 15, 2023 · 1 comment · May be fixed by #6839
Labels
core work For issues that track feature development work being done by core Reaction developers

Comments

@tedraykov
Copy link
Collaborator

tedraykov commented May 15, 2023

Problem:

Currently, when we initiate a password reset through the sendResetAccountPasswordEmail, the authorization plugin prepares an email with the following reset URL:

const url = `${STORE_URL}/?resetToken=${token}`;

Where STORE_URL is a configurable environmental variable and token is the password reset token provided by Accounts JS that should be used later in the resetPassword mutation.

When the customer navigates to the generated link in the mail, they should land on the storefront page responsible for picking the new password.

The format of the generated URL is hardcoded in the authorization plugin and enforces the storefront to implement the password reset UI in one specific route.

An example password reset URL would look like this:

http://localhost:4000/?resetToken=awjdztqpjdasiawejaspo

This forces the storefront developers to implement a password reset login in the index route of the app which may not be desirable.

Proposed solution:

Instead of hardcoding the URL, we can parametrize it by introducing a password reset path fragment environmental variable like PASSWORD_RESET_PATH_FRAGMENT and turn the password reset URL into:

${STORE_URL}/${PASSWORD_RESET_PATH_FRAGMENT}${token}

If we provide the default value of this env var to be ?resetToken=, it will support backward compatibility.

Technically we can set the STORE_URL to a more specific route like http://localhost:4000/password-reset that will evaluate to an URL, but the name of the variable doesn't imply that it will be only used in the password reset scenario. That's why I think it's a better idea to add additional configurable fragment to provide flexibility.

@tedraykov tedraykov added the core work For issues that track feature development work being done by core Reaction developers label May 15, 2023
@tedraykov tedraykov linked a pull request May 15, 2023 that will close this issue
@hariTiwari442
Copy link

Hey!
Please assign this issue to me.
Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core work For issues that track feature development work being done by core Reaction developers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants