Get dynamic content on password reset page & reset password workflow (such as Users name)

Hopefully this post will help assist in creating improved reset password emails, using the persons name (or any other details related to the User data type) along with access to dynamic data on the reset_pw page such as showing the Users first name on the reset password page, without them being logged in of course (covered in example below). Any questions please feel free to ask:

To start, create a new field on the User data type, this will set to text.

image

Where you have the reset workflow action (e.g. Signup / Login Popup), where the ‘Send password reset email’ work action occurs, you’ll need to set to generate a token only, so it can be saved in a workflow afterwards. But this means in the process of making the token, it will not trigger the email.

So after this step, you’ll either have to use another service to send e.g. SendGrid plugin or re-trigger a send password reset email, details below…

To re-trigger the send email without generating a new token again, use the standard email workflow action:
image
The added benefit is you’ll have a bit more control over the email as well.

Then we can send the reset email to the typed email address (reset password input). In the body of the email, a dynamic expression has been used to ‘Do a search for’ the Users data type to match a constraint of the email to the inputted reset value. This will search and find the Users name on a direct match, as the User will have a unique email assigned for each account.

The ‘Website home URL’ dynamic expression will use the whole website address and change depending if in version-test or not. Then this is pointed to the page reset_pw and ends with the parameter and token ‘?reset’.

Here is the email that the User would then receive (this example generated in version-test, otherwise in live, it would be without this prefix):
image

Then for the reset password link, this is just the home URL with the parameter ‘reset’ and the result of step 1 (the generated token).

The next step is to save the generated token from step 1. We can use the similar dynamic expression to find the right User to save this value to (searches to find the user matching the email and saves the token as text):

Now onto the ‘reset_pw’ page. Here we just need to add a text element, where the Users name will sit. Then add the dynamic expression to search for this value:
image

So its searching for a list of Users, with the contraint of the ‘Reset Token’ field to equal the parameter from the page. This is the reset token. Its generated as a parameter which is handy to grab by setting the name to reset.
image

Then to finish the expression, finding the 1st item, as the reset token generated by Bubble should be unique (like the unique IDs on entries) and then the field Name (or First Name depending your setup).

End result on the reset_pw page, pulling in the related dynamic data.
image

To speed things up, these workflows could be migrated to an API workflow to avoid wait time.

11 Likes

Hi,

I appreciate the smart solution but I still think the Current Page User’s Name should be implemented and should be an easy fix for Bubble. For now I’ve just added some generic text.

I struggled trying to get this to work not using sendgrid, specifically, the ability for the link to be a clickable link and not just a string of text being the URL.

To use the bubble default email send function and get your dynamic link be a clickable link make sure before you use the website home URL you place [link=

after that put the url as explained above

then following that url as explained above add ]

then follow ] with the text you want the link to read such as Reset Password and then close it all out with [/link]

Screen Shot 2020-05-26 at 1.28.19 PM

This way you get a clickable link in the email without using sendgrid to do so.

2 Likes

Hi, I found this

Password reset

filmed by Teacher

Thanks for the link…I have this figured out already…my post on this thread was providing a bit more advanced functionality to get a link that is clickable into the normal email sent that can be viewed as “Reset Password” text

Hi! I was having issues with the send password link using the bubble send mail function so I came into the forum looking for answers and found this instead…tried it and it worked perfectly! Thanks so much!

1 Like

I need help

I have followed the steps as they are here and a couple of things happen.
1- generates the new token to the user correctly.
2- send the email to the user correctly
3- On the page to reset the password, it does not show the user’s data, I have tried with the name, email and others. I also see that the generated token is the same as the one shown in the url.

4- when entering the new password it generates an error message
“Error message:
This password reset request is invalid”

I want to apologize.

Well, after carefully reviewing my configuration, I found that I was missing a letter in the link. I have corrected that and it works very well

1 Like