Dynamic password reset page based on query params

I am following the invite user flow where a user account can be created via the management API and then sending the password change ticket to the new user via email.

The docs seem to suggest that you can modify the password reset page based on query params after the # in the url. However there doesn’t seem to be any default way to do this in the password reset template.

Are we expected to use vanilla JS within the page template to access the query params ourselves and modify the template that way?

Yes that is correct, that doc is suggesting you pass a query param and use that param to make whatever changes you would like to the password reset page.

Thanks, so for others wondering this is what I have done.

In the <script> element at the bottom of the page template I added the following;

 var href = window.location.href
 var qsParams = href.substring(href.indexOf("#") + 1);
 var parsedQsParams = new URLSearchParams(qsParams);
 var isInvite = parsedQsParams.get('type') === "invite"

the isInvite var is then used in the dict below to set the content values e.g.

title: isInvite ? "Set a password" : "Change Password",

4 Likes

Thanks for providing your solution!

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.