Skip to content

fix: handle null user properly in forget password function #1224

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Rk-2005
Copy link

@Rk-2005 Rk-2005 commented Mar 1, 2025

Description

This PR fixes an issue in the forgetPassword.js function where the code attempted to access user._id even when user was null. The fix adds a proper null check before accessing user._id.

Related Issues

Closes #1222

Steps to Test

Try resetting the password with an unregistered email.
Ensure the correct error message is returned: "No account with this email has been registered."
Try resetting the password with a valid email to confirm existing functionality remains unchanged.

Screenshots (if applicable)

Before
image
After
image

Checklist

y I have tested these changes
y I have updated the relevant documentation
y I have commented my code, particularly in hard-to-understand areas
y I have made corresponding changes to the codebase
y My changes generate no new warnings or errors
The title of my pull request is clear and descriptive

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix Issue Handling in Forget Password Function
1 participant