fix(auth): add forgot password page#147
Conversation
|
Hi @Divv1524 , |
|
Hi @Divv1524 , If possible please integrate the Frontend with backend api created in #117 |
483268c to
d52e665
Compare
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.
| } 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."; | ||
|
|
| 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."} |
|
Hi @Divv1524 , |
integratethe changes from backend and frontend for forgot password page
d52e665 to
67007f8
Compare
Hi @rdodiya, Reviewed and addressed the Copilot suggestions:
Testing:
|
|
Hi @rdodiya Just a gentle follow-up. |
|
Hi @Divv1524, For invalid input like
Currently, both success and error messages are displayed together, which creates incorrect UI behavior. Also, after entering the correct token value again, two success messages are displayed simultaneously. It seems the current implementation is appending the new success message without clearing the previous state/message properly.
Please handle the message state correctly so only one relevant message is visible at a time. |



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.