[GH-ISSUE #647] forget password returning to onSuccess despite onError if email not found #8358

Closed
opened 2026-04-13 03:25:42 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @rizkraf on GitHub (Nov 24, 2024).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/647

Describe the bug
forget password function returns to onSuccess block despite it should go to onError block because error user/email not found

To Reproduce
Steps to reproduce the behavior:

  1. Call forgetPassword() function from auth client
  2. Enter incorrect or not found email

Expected behavior
Returning onError context if email error/not found, like in signIn function
image

Screenshots
image
image
image

Originally created by @rizkraf on GitHub (Nov 24, 2024). Original GitHub issue: https://github.com/better-auth/better-auth/issues/647 **Describe the bug** forget password function returns to `onSuccess` block despite it should go to `onError` block because `error user/email not found` **To Reproduce** Steps to reproduce the behavior: 1. Call `forgetPassword()` function from auth client 2. Enter incorrect or not found email **Expected behavior** Returning `onError` context if email error/not found, like in `signIn` function ![image](https://github.com/user-attachments/assets/3b7fa45f-794d-48f6-90e9-1ad3784718d7) **Screenshots** ![image](https://github.com/user-attachments/assets/489f2a11-caf3-404a-809c-12b857bd36ba) ![image](https://github.com/user-attachments/assets/f7234fc8-1139-4ea5-9639-d3d4dc65c98b) ![image](https://github.com/user-attachments/assets/bb60bffb-79bc-48f3-985f-e0de9ea3b026)
GiteaMirror added the locked label 2026-04-13 03:25:42 -05:00
Author
Owner

@Bekacru commented on GitHub (Nov 26, 2024):

This is intentional. We don't want to notify users whether an email exists in our database to avoid leaking unnecessary information. Instead, display a message like: "If the email exists in our database, you'll receive an email."

<!-- gh-comment-id:2499830184 --> @Bekacru commented on GitHub (Nov 26, 2024): This is intentional. We don't want to notify users whether an email exists in our database to avoid leaking unnecessary information. Instead, display a message like: "If the email exists in our database, you'll receive an email."
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#8358