Skip to content

fix: clear form errors on valid email submission in forgot password - #13

Closed
ssurendrannair wants to merge 9 commits into
release-ulmofrom
AUT-145-e-dx-stage-prod-error-message-persists-after-entering-a-valid-email-on-reset-password-page
Closed

fix: clear form errors on valid email submission in forgot password#13
ssurendrannair wants to merge 9 commits into
release-ulmofrom
AUT-145-e-dx-stage-prod-error-message-persists-after-entering-a-valid-email-on-reset-password-page

Conversation

@ssurendrannair

Copy link
Copy Markdown

Here's a PR description for this task:

Summary

On the Reset Password page, when an invalid/blank email was submitted first, the error message ("We were unable to contact you. Enter your email below.") persisted even after a valid email was subsequently submitted and the password reset email was successfully delivered
Fixed by clearing all error states (formErrors, validationError, and Redux emailValidationError) in the else block of handleSubmit before dispatching forgotPassword(email)
The success confirmation alert now renders correctly after a valid submission

Root Cause

ForgotPasswordAlert overrides status to FORM_SUBMISSION_ERROR whenever emailError prop is non-empty. Since formErrors (passed as emailError) was never cleared on a valid submit, the error banner persisted even when the API call succeeded and Redux status became complete.

Changes

  • src/forgot-password/ForgotPasswordPage.jsx — Added setFormErrors(''), setValidationError(''), and props.setForgotPasswordFormData({ email, emailValidationError: '' }) before props.forgotPassword(email) in the handleSubmit else block
  • src/forgot-password/ForgotPasswordPage.test.jsx — Added regression test for the valid-resubmit case to verify error message clears after a valid email is submitted following an invalid one

Steps to Test

  1. Navigate to the Reset Password page
  2. Submit with a blank or invalid email → confirm error message appears
  3. Enter a valid registered email and submit again → confirm error message disappears
  4. Confirm success message is displayed
  5. Confirm password reset email is received in inbox

Environment

Stage / Prod

Copilot AI review requested due to automatic review settings July 6, 2026 18:27

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a UI bug on the Reset Password (Forgot Password) page where an initial invalid/blank submission left an error banner visible even after a subsequent valid submission succeeded, preventing the success confirmation from rendering correctly.

Changes:

  • Clear local error state (formErrors, validationError) and Redux emailValidationError before dispatching forgotPassword(email) on valid submit.
  • Add a regression test intended to cover clearing errors on valid resubmission.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/forgot-password/ForgotPasswordPage.jsx Clears local + Redux validation error state in the valid-submit path before triggering the forgot-password action.
src/forgot-password/tests/ForgotPasswordPage.test.jsx Adds a regression test for the “resubmit with valid email clears prior errors” scenario.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/forgot-password/tests/ForgotPasswordPage.test.jsx
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 7, 2026 07:21

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

@ssurendrannair
ssurendrannair force-pushed the AUT-145-e-dx-stage-prod-error-message-persists-after-entering-a-valid-email-on-reset-password-page branch from 553e43f to f73b1a2 Compare July 7, 2026 07:36
Copilot AI review requested due to automatic review settings July 7, 2026 08:15
@ssurendrannair
ssurendrannair removed the request for review from Copilot July 7, 2026 08:15
Copilot AI review requested due to automatic review settings July 7, 2026 08:16
@ssurendrannair
ssurendrannair removed the request for review from Copilot July 7, 2026 08:16
Copilot AI review requested due to automatic review settings July 7, 2026 08:17
@ssurendrannair
ssurendrannair removed the request for review from Copilot July 7, 2026 08:17
Copilot AI review requested due to automatic review settings July 7, 2026 08:17
@ssurendrannair
ssurendrannair removed the request for review from Copilot July 7, 2026 08:17
@ssurendrannair

Copy link
Copy Markdown
Author

Duplicate PR

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.

3 participants