Skip to content

fix(user_authn): expose country field by default so Profile MFE can list countries#38313

Open
kingoftech-v01 wants to merge 1 commit intoopenedx:masterfrom
kingoftech-v01:fix/bug-38195
Open

fix(user_authn): expose country field by default so Profile MFE can list countries#38313
kingoftech-v01 wants to merge 1 commit intoopenedx:masterfrom
kingoftech-v01:fix/bug-38195

Conversation

@kingoftech-v01
Copy link
Copy Markdown

Description

After the Ulmo upgrade, the country dropdown in the Profile MFE shows no options. This fix changes the default value of REGISTRATION_EXTRA_FIELDS['country'] from 'hidden' to 'optional' so the country list is exposed via the registration form API that the Profile MFE relies on.

User impact (Learner): Learners can once again select their country in the Profile MFE. The country field also becomes an optional field on the registration form by default.

User impact (Operator): Operators who do not want the country field visible on the registration form can override it via site configuration or YAML env config (e.g. REGISTRATION_EXTRA_FIELDS: {country: hidden} or {country: required}).

Root Cause

  1. openedx/envs/common.py:1689REGISTRATION_EXTRA_FIELDS['country'] defaulted to 'hidden'.
  2. openedx/core/djangoapps/user_authn/views/registration_form.py:341_is_field_visible() returns False for 'hidden'.
  3. openedx/core/djangoapps/user_authn/views/registration_form.py:517get_registration_form() skips fields where _is_field_visible() is False.
  4. openedx/core/djangoapps/user_authn/views/register.py:556RegistrationView.get() returns the form description via /api/user/v2/account/registration/.
  5. The Profile MFE consumes that endpoint to obtain the list of country options for its country dropdown. With 'hidden' as the default, the country field and its options list were never in the response.

Previously, Tutor injected country: required in the generated config; that override was removed or changed in Ulmo, exposing the insecure-by-default.

Fix

One-line change in openedx/envs/common.py:

'country': 'optional',  # was 'hidden'

A comment explains the rationale and notes that operators can still override it.

Why not fix the Profile MFE instead?

Decoupling the Profile MFE from the registration form API would require changes in a different repo and a new backend endpoint, and leaves the current API contract broken for any other consumer that needs the country list. Changing the default here:

  • Is a 1-line change
  • Matches the documented workaround in the issue
  • Is reversible via configuration for operators who want country hidden
  • Gives optional as a sensible platform default (users can choose to provide it or not)

Supporting Information

  • Issue: List of countries is not showing up in Profile MFE #38195
  • Workaround mentioned in the issue confirms that changing the setting fixes the Profile MFE dropdown.
  • All existing tests that assert specific field lists are protected by @override_settings, so the default change does not affect them.

Testing Instructions

  1. Deploy without any REGISTRATION_EXTRA_FIELDS override
  2. Open the Profile MFE — the country dropdown should show the full list of countries
  3. Open the registration form — the country field should appear as optional
  4. Override REGISTRATION_EXTRA_FIELDS: {country: hidden} in site configuration — the country field should disappear from both the registration form and the Profile MFE

Four new tests are included in openedx/core/djangoapps/user_authn/views/tests/test_register.py:

  • test_unit_country_default_is_optional — Unit
  • test_integration_country_field_exposed_by_default — Integration
  • test_bug_38195_regression_profile_mfe_gets_country_options — Regression
  • test_operator_can_still_hide_country — Backwards-compat for operator override

Deadline

None

Other Information

  • No database migrations
  • No new dependencies
  • No deprecations
  • Backwards compatible via configuration override
  • No security, accessibility, or performance concerns

Closes #38195

…ist countries

The default for REGISTRATION_EXTRA_FIELDS['country'] was 'hidden', which
caused the registration form API to exclude the country field and its
options list. The Profile MFE depends on this API to render its country
dropdown, so the dropdown showed no options after the Ulmo upgrade.

Change the default to 'optional'. Operators who do not want the country
field on the registration form can still override it to 'hidden' via
site configuration or YAML env config.

Closes openedx#38195
@kingoftech-v01 kingoftech-v01 requested a review from a team as a code owner April 10, 2026 03:18
@openedx-webhooks
Copy link
Copy Markdown

Thanks for the pull request, @kingoftech-v01!

This repository is currently maintained by @openedx/wg-maintenance-openedx-platform.

Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review.

🔘 Get product approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.
🔘 Provide context

To help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads
🔘 Submit a signed contributor agreement (CLA)

⚠️ We ask all contributors to the Open edX project to submit a signed contributor agreement or indicate their institutional affiliation.
Please see the CONTRIBUTING file for more information.

If you've signed an agreement in the past, you may need to re-sign.
See The New Home of the Open edX Codebase for details.

Once you've signed the CLA, please allow 1 business day for it to be processed.
After this time, you can re-run the CLA check by adding a comment below that you have signed it.
If the CLA check continues to fail, you can tag the @openedx/cla-problems team in a comment for further assistance.

🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.

Details
Where can I find more information?

If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:

When can I expect my changes to be merged?

Our goal is to get community contributions seen and reviewed as efficiently as possible.

However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Apr 10, 2026
@github-project-automation github-project-automation bot moved this to Needs Triage in Contributions Apr 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

open-source-contribution PR author is not from Axim or 2U

Projects

Status: Needs Triage

Development

Successfully merging this pull request may close these issues.

List of countries is not showing up in Profile MFE

2 participants