Support getting user email from reset token #1332

Closed
opened 2026-03-13 08:33:21 -05:00 by GiteaMirror · 5 comments
Owner

Originally created by @SaviruFr on GitHub (Jun 9, 2025).

Is this suited for github?

  • Yes, this is suited for github

When a user resets their password using the reset token from the forgot password email, only the token is available, not the user's email. This makes it hard to send a confirmation email after the password is changed.

Describe the solution you'd like

Allow getting the user's email from the reset token.

Describe alternatives you've considered

querying the database to find the user by token.

Additional context

No response

Originally created by @SaviruFr on GitHub (Jun 9, 2025). ### Is this suited for github? - [x] Yes, this is suited for github ### Is your feature request related to a problem? Please describe. When a user resets their password using the reset token from the forgot password email, only the token is available, not the user's email. This makes it hard to send a confirmation email after the password is changed. ### Describe the solution you'd like Allow getting the user's email from the reset token. ### Describe alternatives you've considered querying the database to find the user by token. ### Additional context _No response_
Author
Owner

@Kinfe123 commented on GitHub (Jun 9, 2025):

you can use emailAndPassword options with the auth config -

emailAndPassword: {
		enabled: true,
		async sendResetPassword({ user, url }) {
			await resend.emails.send({
				from,
				to: user.email,
				subject: "Reset your password",
				react: reactResetPasswordEmail({
					username: user.email,
					resetLink: url,
				}),
			});
		},
	},
@Kinfe123 commented on GitHub (Jun 9, 2025): you can use emailAndPassword options with the auth config - ```ts emailAndPassword: { enabled: true, async sendResetPassword({ user, url }) { await resend.emails.send({ from, to: user.email, subject: "Reset your password", react: reactResetPasswordEmail({ username: user.email, resetLink: url, }), }); }, }, ```
Author
Owner

@SaviruFr commented on GitHub (Jun 9, 2025):

you can use emailAndPassword options with the auth config -

emailAndPassword: {
enabled: true,
async sendResetPassword({ user, url }) {
await resend.emails.send({
from,
to: user.email,
subject: "Reset your password",
react: reactResetPasswordEmail({
username: user.email,
resetLink: url,
}),
});
},
},

I'm trying to send a success email after the password has actually been reset.

@SaviruFr commented on GitHub (Jun 9, 2025): > you can use emailAndPassword options with the auth config - > > emailAndPassword: { > enabled: true, > async sendResetPassword({ user, url }) { > await resend.emails.send({ > from, > to: user.email, > subject: "Reset your password", > react: reactResetPasswordEmail({ > username: user.email, > resetLink: url, > }), > }); > }, > }, I'm trying to send a success email after the password has actually been reset.
Author
Owner

@SaviruFr commented on GitHub (Jun 9, 2025):

Not sure why this was closed. This is still a valid request, can you reopen it? @Kinfe123

@SaviruFr commented on GitHub (Jun 9, 2025): Not sure why this was closed. This is still a valid request, can you reopen it? @Kinfe123
Author
Owner

@Kinfe123 commented on GitHub (Jun 11, 2025):

hey there this is the pr regarding to this issue - #2994

this should help on your issue

npm i https://pkg.pr.new/better-auth/better-auth@2994

can you try it

@Kinfe123 commented on GitHub (Jun 11, 2025): hey there this is the pr regarding to this issue - #2994 this should help on your issue ``` npm i https://pkg.pr.new/better-auth/better-auth@2994 ``` can you try it
Author
Owner

@SaviruFr commented on GitHub (Jun 12, 2025):

just tested it, works well. thanks for adding it :)

@SaviruFr commented on GitHub (Jun 12, 2025): just tested it, works well. thanks for adding it :)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#1332