fix(auth): add forgot password page#147
Open
Divv1524 wants to merge 2 commits into
Open
Conversation
Owner
|
Hi @Divv1524 , |
Owner
|
Hi @Divv1524 , If possible please integrate the Frontend with backend api created in #117 |
483268c to
d52e665
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Implements a functional forgot/reset password UI for the public auth flow, replacing the previous placeholder screen.
Changes:
- Replaced the placeholder
ForgotPasswordpage with a multi-step flow (request reset code → submit code + new password → completion state). - Added client-side validation (Formik + Yup), loading states, and inline success/error messaging.
- Integrated API calls for forgot-password and reset-password via the shared Axios client.
Comments suppressed due to low confidence (1)
RestroHub-FrontEnd/src/pages/public/ForgotPassword.jsx:222
- The reset-password catch block has the same issue as the request step: getApiMessage(..., fallback) returns a non-empty fallback when err.response is absent, preventing err.message (including messages from locally thrown Errors) from being displayed. Reorder the fallback logic so err.message is used when there is no backend response message.
} catch (err) {
const message =
getApiMessage(err.response?.data, "Password reset failed.") ||
err.message ||
"Password reset failed.";
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+168
to
+176
| } catch (err) { | ||
| const message = | ||
| getApiMessage( | ||
| err.response?.data, | ||
| "Unable to send reset instructions. Please try again." | ||
| ) || | ||
| err.message || | ||
| "Unable to send reset instructions. Please try again."; | ||
|
|
Comment on lines
+197
to
+202
| const res = await api.post("/public/api/v1/auth/reset-password", null, { | ||
| params: { | ||
| email: requestedEmail, | ||
| token: token.trim(), | ||
| newPassword, | ||
| }, |
| <p className="mb-8 text-sm leading-6 text-gray-500 dark:text-gray-400"> | ||
| {step === "request" | ||
| ? "Enter your registered email address and we will send a reset code." | ||
| : "Use the reset code sent to your email and choose a new password."} |
Owner
|
Hi @Divv1524 , |
integratethe changes from backend and frontend for forgot password page
d52e665 to
67007f8
Compare
Author
Hi @rdodiya, Reviewed and addressed the Copilot suggestions:
Testing:
|
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.
Issue Link
Closes #82
Changes Made
/forgot-passwordpage matching the existing auth UI./public/api/v1/auth/forgot-password.GoogleOAuthProviderso the login page renders correctly and the forgot password link can be used.Type of Change
Testing Performed
Frontend Testing
Test Cases:
/forgot-passwordroute renders reset form.success: falseresponse shows inline error./forgot-password.UI/UX Changes
Additional Notes
npm.cmd run buildpasses.npm.cmd run lintcould not run because the repo does not currently include an ESLint 9eslint.config.jsfile.