diff --git a/lms/envs/common.py b/lms/envs/common.py index 0e2a5ae3a8..cf8d258674 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -3570,9 +3570,9 @@ REGISTRATION_FIELD_ORDER = [ "city", "state", "country", - "gender", "year_of_birth", "level_of_education", + "gender", "specialty", "profession", "company", diff --git a/openedx/core/djangoapps/user_authn/api/helper.py b/openedx/core/djangoapps/user_authn/api/helper.py index 55c38dd4d7..21bd7c278d 100644 --- a/openedx/core/djangoapps/user_authn/api/helper.py +++ b/openedx/core/djangoapps/user_authn/api/helper.py @@ -96,7 +96,7 @@ class RegistrationFieldsContext(APIView): return (field in self.user_profile_fields or field in ["terms_of_service", "honor_code"] or field in configuration_helpers.get_value('extended_profile_fields', [])) - def _get_fields(self): + def get_fields(self): """ Returns the required or optional fields configured in REGISTRATION_EXTRA_FIELDS settings. """ diff --git a/openedx/core/djangoapps/user_authn/api/tests/test_views.py b/openedx/core/djangoapps/user_authn/api/tests/test_views.py index f7acaeb692..236c096bcb 100644 --- a/openedx/core/djangoapps/user_authn/api/tests/test_views.py +++ b/openedx/core/djangoapps/user_authn/api/tests/test_views.py @@ -240,7 +240,8 @@ class MFEContextViewTest(ThirdPartyAuthTestMixin, APITestCase): 'error_message': '', } } - response = self.client.get(self.url) + self.query_params.update({'is_register_page': True}) + response = self.client.get(self.url, self.query_params) assert response.status_code == status.HTTP_200_OK assert response.data['optional_fields']['fields'] == expected_response @@ -274,7 +275,8 @@ class MFEContextViewTest(ThirdPartyAuthTestMixin, APITestCase): 'type': 'text', } } - response = self.client.get(self.url) + self.query_params.update({'is_register_page': True}) + response = self.client.get(self.url, self.query_params) assert response.status_code == status.HTTP_200_OK assert response.data['optional_fields']['fields'] == expected_response @@ -292,7 +294,8 @@ class MFEContextViewTest(ThirdPartyAuthTestMixin, APITestCase): """ Test that order of optional fields """ - response = self.client.get(self.url) + self.query_params.update({'is_register_page': True}) + response = self.client.get(self.url, self.query_params) assert response.status_code == status.HTTP_200_OK assert list(response.data['optional_fields']['fields'].keys()) == ['specialty', 'goals'] diff --git a/openedx/core/djangoapps/user_authn/api/views.py b/openedx/core/djangoapps/user_authn/api/views.py index 63e1d2fb3a..1ca209afff 100644 --- a/openedx/core/djangoapps/user_authn/api/views.py +++ b/openedx/core/djangoapps/user_authn/api/views.py @@ -60,17 +60,17 @@ class MFEContextView(APIView): if settings.ENABLE_DYNAMIC_REGISTRATION_FIELDS: if is_register_page: - registration_fields = RegistrationFieldsContext()._get_fields() # pylint: disable=protected-access + registration_fields = RegistrationFieldsContext().get_fields() context['registration_fields'].update({ 'fields': registration_fields, 'extended_profile': configuration_helpers.get_value('extended_profile_fields', []), }) - optional_fields = RegistrationFieldsContext('optional')._get_fields() # pylint: disable=protected-access - if optional_fields: - context['optional_fields'].update({ - 'fields': optional_fields, - 'extended_profile': configuration_helpers.get_value('extended_profile_fields', []), - }) + optional_fields = RegistrationFieldsContext('optional').get_fields() + if optional_fields: + context['optional_fields'].update({ + 'fields': optional_fields, + 'extended_profile': configuration_helpers.get_value('extended_profile_fields', []), + }) return Response( status=status.HTTP_200_OK,