Skip to content

Aut 145 edx resetpasswordpage bug - #14

Closed
ssurendrannair wants to merge 6 commits into
release-ulmofrom
AUT-145-edx-resetpasswordpage-bug
Closed

Aut 145 edx resetpasswordpage bug#14
ssurendrannair wants to merge 6 commits into
release-ulmofrom
AUT-145-edx-resetpasswordpage-bug

Conversation

@ssurendrannair

Copy link
Copy Markdown

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
Navigate to the Reset Password page
Submit with a blank or invalid email → confirm error message appears
Enter a valid registered email and submit again → confirm error message disappears
Confirm success message is displayed
Confirm password reset email is received in inbox

Environment
Stage / Prod

Copilot AI review requested due to automatic review settings July 7, 2026 07:45

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 UX bug on the Reset Password (Forgot Password) page where an initial invalid/blank email submission could leave the error banner stuck even after a subsequent valid submission succeeds, by explicitly clearing local and Redux-backed error state before dispatching the forgot-password action. Adds a regression test for the invalid-then-valid resubmit flow.

Changes:

  • Clear local formErrors / validationError and Redux emailValidationError before dispatching forgotPassword(email) on valid submit.
  • Add/adjust unit test coverage to exercise the invalid → valid resubmit scenario.

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 so the success UI is not overridden by a stale error state.
src/forgot-password/tests/ForgotPasswordPage.test.jsx Adds a regression test intended to verify the error banner clears on a valid resubmission after an invalid submission.

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

Comment on lines +253 to +265
// Then resubmit with a valid email and verify the banner + validation error are cleared.
const emailInput = screen.getByLabelText('Email');
fireEvent.change(emailInput, { target: { value: 'registered@example.com' } });
fireEvent.click(screen.getByText('Submit'));

expect(store.dispatch).toHaveBeenCalledWith(forgotPassword('registered@example.com'));
expect(store.dispatch).toHaveBeenCalledWith(setForgotPasswordFormData({
email: 'registered@example.com',
emailValidationError: '',
}));
expect(container.querySelector('.pgn__form-text-invalid')).toBeNull();
expect(container.querySelector('.alert-danger')).toBeNull();
});
@ssurendrannair
ssurendrannair force-pushed the AUT-145-edx-resetpasswordpage-bug branch from c895a7c to 4c85f09 Compare July 7, 2026 07:53
@ssurendrannair

Copy link
Copy Markdown
Author

Duplicate PR for PR-15

@ssurendrannair
ssurendrannair deleted the AUT-145-edx-resetpasswordpage-bug branch July 7, 2026 08:59
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.

2 participants