Skip to content

fix: prioritize registration errors over inline validations#1640

Merged
arbrandes merged 1 commit into
openedx:masterfrom
arbrandes:fix-register-validation-messages
Mar 5, 2026
Merged

fix: prioritize registration errors over inline validations#1640
arbrandes merged 1 commit into
openedx:masterfrom
arbrandes:fix-register-validation-messages

Conversation

@arbrandes
Copy link
Copy Markdown
Contributor

@arbrandes arbrandes commented Mar 5, 2026

Description

  • Registration errors from form submission (e.g., "password too similar to username") were being masked by stale inline validation results
  • The backendValidations memo in RegisterContext checked state.validations (set during on-blur inline validation) before state.registrationError (set on form submission failure), so submission errors were never surfaced to the user
  • Swapped the priority so registration errors take precedence, and added a unit test covering the scenario

How to reproduce

  1. Go to the registration page
  2. Fill out all fields, using a password that contains the username (e.g., username testuser, password testuser123)
  3. Submit the form
  4. The server returns a "The password is too similar to the username." error, but no error message is displayed next to the password field

How to test

  1. Go to the registration page
  2. Fill out all fields, using a password that contains the username (e.g., username testuser, password testuser123)
  3. Submit the form
  4. The error message "The password is too similar to the username." is now displayed next to the password field

…dValidations

Registration errors from form submission (e.g., "password too similar to
username") were being masked by stale inline validation results. The
backendValidations memo checked state.validations first, which was set
during on-blur field validation with no errors, causing it to never reach
the registrationError branch.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.02%. Comparing base (642853e) to head (eb1747e).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1640      +/-   ##
==========================================
+ Coverage   87.58%   91.02%   +3.43%     
==========================================
  Files         125      110      -15     
  Lines        2312     2350      +38     
  Branches      649      666      +17     
==========================================
+ Hits         2025     2139     +114     
+ Misses        278      204      -74     
+ Partials        9        7       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@arbrandes arbrandes merged commit 93bd0f2 into openedx:master Mar 5, 2026
6 checks passed
@arbrandes arbrandes deleted the fix-register-validation-messages branch March 5, 2026 20:14
Copy link
Copy Markdown
Contributor

@jesusbalderramawgu jesusbalderramawgu left a comment

Choose a reason for hiding this comment

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

LGTM!

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