Aut 145 edx resetpasswordpage bug - #14
Closed
ssurendrannair wants to merge 6 commits into
Closed
Conversation
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
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/validationErrorand ReduxemailValidationErrorbefore dispatchingforgotPassword(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
force-pushed
the
AUT-145-edx-resetpasswordpage-bug
branch
from
July 7, 2026 07:53
c895a7c to
4c85f09
Compare
Author
|
Duplicate PR for PR-15 |
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.
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