How to send Reset password email to a "secondary" email from metadata instead of main email

Hello, assuming there is a user with email “main@mail.com” and username “username” and app_metadata containing “anotheremail” : “other@mail.com

when user click “forgot password” I want the email to be send to other@mail.com.
Is there any way to achieve this ? may be some action to intercept and replace email or some way to customize the reset password form?

Many thanks,

Hi @victor2048,

Welcome to the Auth0 Community!

Unfortunately, the functionality of the “Forgot password” button cannot be modified. It will send an email to the primary address on his account.

However, you can create a custom button on your website that asks for the user’s primary email, makes a password change ticket for their account, and then sends it to their secondary email address.

Feel free to reach out if you have any questions on the implementation or any other questions.

Have a good one,
Vlad

Thanks Vlad, that’s what I’ve been trying to achieve,
I’m customising Reset password window and call my server api instead of continue button, I create a ticket and email it to a secondary email …

but sometimes the ticket brings up the screen which asks to enter the password twice, and this is what I wanted. however under some conditions I’m getting the previous screen “enter username and we email the instructions …” … I can’t figure out what triggers a wrong screen, and now it’s just working fine so I can’t even reproduce it :slight_smile:

may be you could give me some clue what could potentially make the ticket url open another screen. I might had have other reset passwords running in the same browser which could result in some cookies clashes…

Many thanks,
Victor

Hi @victor2048,

It will only ask for your email if you select “forgot password” from the new Universal Login page. However, that will send the password reset ticket to your primary email, not the one saved in app_metadata.

What I suggested was a custom implementation on your website, since you can’t modify the new Universal Login directly.

Have a good one,
Vlad