diff --git a/common/djangoapps/student/helpers.py b/common/djangoapps/student/helpers.py index cfb047f1a947..01ded41d9423 100644 --- a/common/djangoapps/student/helpers.py +++ b/common/djangoapps/student/helpers.py @@ -742,7 +742,8 @@ def do_create_account(form, custom_form=None): profile_fields = [ "name", "level_of_education", "gender", "mailing_address", "city", "country", "goals", "year_of_birth", "national_id", "phone_number", "date_of_birth", "region", "address_line", - "english_language_level", "employment_status", "work_experience_level", "job_title", "terms_and_conditions" + "english_language_level", "employment_status", "work_experience_level", "job_title", "terms_and_conditions", + "arabic_name", ] profile = UserProfile( user=user, diff --git a/lms/envs/common.py b/lms/envs/common.py index e57774643e01..57541a986b5a 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -4152,7 +4152,7 @@ def _make_locale_paths(settings): # pylint: disable=missing-function-docstring 'employment_status', 'work_experience_level', 'job_title', - + 'arabic_name', # Not an actual field, but used to signal whether badges should be public. 'accomplishments_shared', ] diff --git a/openedx/core/djangoapps/user_api/accounts/serializers.py b/openedx/core/djangoapps/user_api/accounts/serializers.py index 2aef5a32409d..312af6ad3a1f 100644 --- a/openedx/core/djangoapps/user_api/accounts/serializers.py +++ b/openedx/core/djangoapps/user_api/accounts/serializers.py @@ -180,6 +180,7 @@ def to_representation(self, user): # lint-amnesty, pylint: disable=arguments-di "employment_status": None, "work_experience_level": None, "job_title": None, + "arabic_name": None, } if user_profile: @@ -218,6 +219,7 @@ def to_representation(self, user): # lint-amnesty, pylint: disable=arguments-di "employment_status": AccountLegacyProfileSerializer.convert_empty_to_None(user_profile.employment_status), "work_experience_level": AccountLegacyProfileSerializer.convert_empty_to_None(user_profile.work_experience_level), "job_title": AccountLegacyProfileSerializer.convert_empty_to_None(user_profile.job_title), + "arabic_name": AccountLegacyProfileSerializer.convert_empty_to_None(user_profile.arabic_name), } ) @@ -308,7 +310,7 @@ class Meta: "name", "gender", "goals", "year_of_birth", "level_of_education", "country", "state", "social_links", "mailing_address", "bio", "profile_image", "requires_parental_consent", "language_proficiencies", "phone_number", "city", "date_of_birth", "region", "city", "address_line", "english_language_level", - "employment_status", "work_experience_level", "job_title" + "employment_status", "work_experience_level", "job_title", "arabic_name", ) # Currently no read-only field, but keep this so view code doesn't need to know. read_only_fields = () diff --git a/openedx/core/djangoapps/user_authn/views/register.py b/openedx/core/djangoapps/user_authn/views/register.py index 34da53a2dcc6..d921140ec9f9 100644 --- a/openedx/core/djangoapps/user_authn/views/register.py +++ b/openedx/core/djangoapps/user_authn/views/register.py @@ -179,6 +179,7 @@ def create_account_with_params(request, params): # pylint: disable=too-many-sta extra_fields["work_experience_level"] = "required" extra_fields["job_title"] = "required" extra_fields["terms_and_conditions"] = "required" + extra_fields["arabic_name"] = "required" if is_registration_api_v1(request): if 'confirm_email' in extra_fields: diff --git a/openedx/core/djangoapps/user_authn/views/registration_form.py b/openedx/core/djangoapps/user_authn/views/registration_form.py index 42a4c481de4b..ebe3da3f648c 100644 --- a/openedx/core/djangoapps/user_authn/views/registration_form.py +++ b/openedx/core/djangoapps/user_authn/views/registration_form.py @@ -192,7 +192,6 @@ def __init__( error_message_dict = { "level_of_education": _("A level of education is required"), - "gender": _("Your gender is required"), "year_of_birth": _("Your year of birth is required"), "mailing_address": _("Your mailing address is required"), "goals": _("A description of your goals is required"), @@ -201,6 +200,7 @@ def __init__( "phone_number": _("Your phone number is required"), "date_of_birth": _("Your date of birth is required"), "gender": _("Your gender is required"), + "arabic_name": _("A arabic name is required"), } for field_name, field_value in extra_fields.items(): if field_name not in self.fields: @@ -362,6 +362,7 @@ def __init__(self): "employment_status", "work_experience_level", "job_title", + "arabic_name", ] if settings.ENABLE_COPPA_COMPLIANCE and 'year_of_birth' in self.EXTRA_FIELDS: @@ -1354,6 +1355,31 @@ def _add_terms_of_service_field(self, form_desc, required=True): }, ) + def _add_arabic_name_field(self, form_desc, required=True): + """Add a arabic name field to a form description. + Arguments: + form_desc: A form description + Keyword Arguments: + required (bool): Whether this field is required; defaults to True + """ + # Translators: This label appears above a field on the registration form + # meant to hold the user's arabic name. + name_label = _("Arabic Name") + + # Translators: These instructions appear on the registration form, immediately + # below a field meant to hold the user's arabic name. + name_instructions = _("This name will be used on any certificates that you earn.") + + form_desc.add_field( + "arabic_name", + label=name_label, + instructions=name_instructions, + restrictions={ + "max_length": accounts.NAME_MAX_LENGTH, + }, + required=required + ) + def _apply_third_party_auth_overrides(self, request, form_desc): """Modify the registration form if the user has authenticated with a third-party provider. If a user has successfully authenticated with a third-party provider,