fix: bind password reset to verified OTP token#2102
Open
hariom888 wants to merge 2 commits into
Open
Conversation
Contributor
|
Thank you @, for creating the PR and contributing to our UltimateHealth project 💗. |
Contributor
Automated Review FeedbackProvide actionable comments grouped by severity: Important
Suggestions
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #1539.
This PR strengthens the password reset flow by preserving the OTP verification result and forwarding a short-lived reset token to the password reset endpoint.
Previously, the frontend discarded the response from
/user/verifyOtpand only navigated toNewPasswordScreenwith the user's email. The password reset request therefore contained only:emailnewPasswordwhich provided no cryptographic proof that the OTP had actually been verified.
Changes
useVerifyOtpMutationto return the full API response instead of only the message string.VerifyOtpResponsecontaining:messageresetTokenOtpScreento forward theresetTokenwhen navigating toNewPasswordScreen.useChangePasswordMutationto includeresetTokenin the password reset request.NewPasswordScreento require a validresetTokenbefore allowing password reset.resetToken.Security Improvement
This change creates a frontend binding between successful OTP verification and password reset by ensuring that the password update request carries a reset credential produced during OTP verification.
The frontend now expects the backend to issue a short-lived, single-use reset token after successful OTP verification and validate that token before changing the user's password.
Testing