Before submitting
Bug summary
In ForgotPassword.js, handleResendOtp sends the raw email state value to authService.resendOtp without trimming it, while the other two handlers (handleSendResetCode and handleResetPassword) both trim the email before sending. This inconsistency means a resend request could use a differently-normalized email than the original request that started the flow.
Steps to reproduce
- Go to the Forgot Password page .
- Enter an email with a leading or trailing space, e.g. via paste: " user@example.com".
- Submit — step 1 correctly trims and sends "user@example.com" (via authService.forgotPassword(trimmedEmail)).
- Proceed to step 2.
- Click "Resend Code".
- Inspect the request sent by handleResendOtp — it sends the untrimmed email (" user@example.com") instead of the trimmed value used in step 3.
Expected behavior
All three handlers (handleSendResetCode, handleResetPassword, handleResendOtp) should consistently send a trimmed email to the backend, so a resend always targets the same normalized email used in the original request.
Actual behavior
handleResendOtp sends email directly:
await authService.resendOtp(email, 'reset');
...instead of trimming it like the other two handlers do:
await authService.forgotPassword(trimmedEmail); // handleSendResetCode
await authService.resetPassword(email.trim(), ...); // handleResetPassword
If email ever contains stray whitespace (e.g. from autofill or paste), the resend request could target a different normalized string than the original, potentially causing the resend to silently fail depending on how the backend handles email lookups.
Screenshots or recordings
No response
Browser and device information
Not browser-specific — this is a logic issue in the component code (frontend/src/components/auth/ForgotPassword.js), reproducible on any browser/device.
Additional context
Suggested fix (one-line change):
- await authService.resendOtp(email, 'reset');
- await authService.resendOtp(email.trim(), 'reset');
Optional follow-up: derive a single trimmed value once (e.g. const trimmedEmail = email.trim();) near the top of the component and reuse it across all three handlers, to prevent this inconsistency from recurring if more handlers are added later.
Before submitting
Bug summary
In ForgotPassword.js, handleResendOtp sends the raw
emailstate value to authService.resendOtp without trimming it, while the other two handlers (handleSendResetCode and handleResetPassword) both trim the email before sending. This inconsistency means a resend request could use a differently-normalized email than the original request that started the flow.Steps to reproduce
Expected behavior
All three handlers (handleSendResetCode, handleResetPassword, handleResendOtp) should consistently send a trimmed email to the backend, so a resend always targets the same normalized email used in the original request.
Actual behavior
handleResendOtp sends
emaildirectly:await authService.resendOtp(email, 'reset');
...instead of trimming it like the other two handlers do:
await authService.forgotPassword(trimmedEmail); // handleSendResetCode
await authService.resetPassword(email.trim(), ...); // handleResetPassword
If email ever contains stray whitespace (e.g. from autofill or paste), the resend request could target a different normalized string than the original, potentially causing the resend to silently fail depending on how the backend handles email lookups.
Screenshots or recordings
No response
Browser and device information
Not browser-specific — this is a logic issue in the component code (frontend/src/components/auth/ForgotPassword.js), reproducible on any browser/device.
Additional context
Suggested fix (one-line change):
Optional follow-up: derive a single trimmed value once (e.g. const trimmedEmail = email.trim();) near the top of the component and reuse it across all three handlers, to prevent this inconsistency from recurring if more handlers are added later.