|
3 | 3 | """
|
4 | 4 |
|
5 | 5 | import copy
|
6 |
| -import re |
7 | 6 | from importlib import import_module
|
| 7 | +from eventtracking import tracker |
| 8 | +import re |
8 | 9 |
|
9 | 10 | from django import forms
|
10 | 11 | from django.conf import settings
|
|
15 | 16 | from django.urls import reverse
|
16 | 17 | from django.utils.translation import gettext as _
|
17 | 18 | from django_countries import countries
|
18 |
| -from eventtracking import tracker |
19 | 19 |
|
20 | 20 | from common.djangoapps import third_party_auth
|
21 | 21 | from common.djangoapps.edxmako.shortcuts import marketing_link
|
22 |
| -from common.djangoapps.student.models import CourseEnrollmentAllowed, UserProfile, email_exists_or_retired |
23 |
| -from common.djangoapps.util.password_policy_validators import ( |
24 |
| - password_validators_instruction_texts, |
25 |
| - password_validators_restrictions, |
26 |
| - validate_password |
27 |
| -) |
28 |
| -from openedx.core.djangoapps.embargo.models import GlobalRestrictedCountry |
29 | 22 | from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
|
30 | 23 | from openedx.core.djangoapps.user_api import accounts
|
31 | 24 | from openedx.core.djangoapps.user_api.helpers import FormDescription
|
32 |
| -from openedx.core.djangoapps.user_authn.utils import check_pwned_password |
33 |
| -from openedx.core.djangoapps.user_authn.utils import is_registration_api_v1 as is_api_v1 |
| 25 | +from openedx.core.djangoapps.user_authn.utils import check_pwned_password, is_registration_api_v1 as is_api_v1 |
34 | 26 | from openedx.core.djangoapps.user_authn.views.utils import remove_disabled_country_from_list
|
35 | 27 | from openedx.core.djangolib.markup import HTML, Text
|
36 | 28 | from openedx.features.enterprise_support.api import enterprise_customer_for_request
|
| 29 | +from common.djangoapps.student.models import ( |
| 30 | + CourseEnrollmentAllowed, |
| 31 | + UserProfile, |
| 32 | + email_exists_or_retired, |
| 33 | +) |
| 34 | +from common.djangoapps.util.password_policy_validators import ( |
| 35 | + password_validators_instruction_texts, |
| 36 | + password_validators_restrictions, |
| 37 | + validate_password, |
| 38 | +) |
37 | 39 |
|
38 | 40 |
|
39 | 41 | class TrueCheckbox(widgets.CheckboxInput):
|
@@ -304,10 +306,7 @@ def clean_country(self):
|
304 | 306 | Check if the user's country is in the embargoed countries list.
|
305 | 307 | """
|
306 | 308 | country = self.cleaned_data.get("country")
|
307 |
| - if ( |
308 |
| - settings.FEATURES.get('EMBARGO', False) and |
309 |
| - country in GlobalRestrictedCountry.get_countries() |
310 |
| - ): |
| 309 | + if country in settings.DISABLED_COUNTRIES: |
311 | 310 | raise ValidationError(_("Registration from this country is not allowed due to restrictions."))
|
312 | 311 | return self.cleaned_data.get("country")
|
313 | 312 |
|
@@ -982,6 +981,7 @@ def _add_country_field(self, form_desc, required=True):
|
982 | 981 | 'country',
|
983 | 982 | default=default_country.upper()
|
984 | 983 | )
|
| 984 | + |
985 | 985 | form_desc.add_field(
|
986 | 986 | "country",
|
987 | 987 | label=country_label,
|
|
0 commit comments