How can i get email from resetPassword
I want to send email to the user to notify that password is changed. But their is only status in data object. How can i get the email of the user?
This is part of forgotPassword flow.
Solution:Jump to solution
Oh just use the token and find the session in your db, and based on that you get the userId, and then you can get the user from that
8 Replies
@Ping any idea?
You should be calling
and on your auth instance, you can get their email to send:
I am already doing that and reset passoword is working. My question is about sending an email after the password the changed to notify the user.
Oh I see.
An idea is to just send a request to a backend endpoint, and using the headers you'll know the user id.
From there, query your db to find the user's email, then send the email.
Make sure to pass your users session in to headers ^
And also take into consideration of rate-limits and security
But user is not loged in yet right?
since the password reset is based on token. I am not sure how can i pass the session to headers, since i dont have the session yet, after reset passoword is successful
lmk if i am missing something
Solution
Oh just use the token and find the session in your db, and based on that you get the userId, and then you can get the user from that
Thanks, i got the user id from verification table, it was in value column
Oh, okay cool