diff --git a/common/djangoapps/student/forms.py b/common/djangoapps/student/forms.py index 4a6f236b0d6bad250ea4cab4d644957ad134e8e7..4d96fdabb686de600e9dd0785213f84740428003 100644 --- a/common/djangoapps/student/forms.py +++ b/common/djangoapps/student/forms.py @@ -248,7 +248,7 @@ class AccountCreationForm(forms.Form): """ _EMAIL_INVALID_MSG = _("A properly formatted e-mail is required") - _NAME_TOO_SHORT_MSG = _("Your legal name must be a minimum of two characters long") + _NAME_TOO_SHORT_MSG = _("Your legal name must be a minimum of one character long") # TODO: Resolve repetition diff --git a/common/test/acceptance/tests/lms/test_account_settings.py b/common/test/acceptance/tests/lms/test_account_settings.py index 3c0db1003b394467fe41ab2b823c46126b05ae25..411213227223f666432f912b7ca59492b7b862d0 100644 --- a/common/test/acceptance/tests/lms/test_account_settings.py +++ b/common/test/acceptance/tests/lms/test_account_settings.py @@ -291,7 +291,7 @@ class AccountSettingsPageTest(AccountSettingsTestMixin, AcceptanceTest): u'name', u'Full Name', self.full_name, - u'@', + u' ', [u'<h1>another name<h1>', u'<script>'], 'Full Name cannot contain the following characters: < >', False diff --git a/lms/djangoapps/verify_student/tests/test_views.py b/lms/djangoapps/verify_student/tests/test_views.py index 319554e963de98d10e17707fb5d3c8ac4b6285f6..8e3717f7ca1f6561a7db1aa6ae28fb05b063ea75 100644 --- a/lms/djangoapps/verify_student/tests/test_views.py +++ b/lms/djangoapps/verify_student/tests/test_views.py @@ -1549,10 +1549,10 @@ class TestSubmitPhotosForVerification(TestCase): response = self._submit_photos( face_image=self.IMAGE_DATA, photo_id_image=self.IMAGE_DATA, - full_name="a", + full_name="", expected_status_code=400 ) - self.assertEqual(response.content, "Name must be at least 2 characters long.") + self.assertEqual(response.content, "Name must be at least 1 character long.") def test_missing_required_param(self): # Missing face image parameter diff --git a/lms/djangoapps/verify_student/views.py b/lms/djangoapps/verify_student/views.py index abf08aadc14df12ae38436ff692ba6c8ae32a3cd..d194fb3f241505a30da7cd046ada2f737605e4cf 100644 --- a/lms/djangoapps/verify_student/views.py +++ b/lms/djangoapps/verify_student/views.py @@ -993,7 +993,7 @@ class SubmitPhotosView(View): return HttpResponseBadRequest(_("No profile found for user")) except AccountValidationError: msg = _( - u"Name must be at least {min_length} characters long." + u"Name must be at least {min_length} character long." ).format(min_length=NAME_MIN_LENGTH) return HttpResponseBadRequest(msg) diff --git a/openedx/core/djangoapps/user_api/accounts/__init__.py b/openedx/core/djangoapps/user_api/accounts/__init__.py index 54ee6c2c655f0b3c4a60a538d66fb81703b602f0..864daf45d32c2631ea92cadbb429da8693701b88 100644 --- a/openedx/core/djangoapps/user_api/accounts/__init__.py +++ b/openedx/core/djangoapps/user_api/accounts/__init__.py @@ -11,7 +11,7 @@ from django.utils.translation import ugettext_lazy as _ BIO_MAX_LENGTH = 300 # The minimum and maximum length for the name ("full name") account field -NAME_MIN_LENGTH = 2 +NAME_MIN_LENGTH = 1 NAME_MAX_LENGTH = 255 # The minimum and maximum length for the username account field diff --git a/openedx/core/djangoapps/user_api/accounts/serializers.py b/openedx/core/djangoapps/user_api/accounts/serializers.py index 8e7f7e80995e998b23dd41e01021b97e7e828932..c4072f1324d569495745ded51ddd4dd84e21c87f 100644 --- a/openedx/core/djangoapps/user_api/accounts/serializers.py +++ b/openedx/core/djangoapps/user_api/accounts/serializers.py @@ -233,7 +233,7 @@ class AccountLegacyProfileSerializer(serializers.HyperlinkedModelSerializer, Rea """ Enforce minimum length for name. """ if len(new_name) < NAME_MIN_LENGTH: raise serializers.ValidationError( - u"The name field must be at least {} characters long.".format(NAME_MIN_LENGTH) + u"The name field must be at least {} character long.".format(NAME_MIN_LENGTH) ) return new_name diff --git a/openedx/core/djangoapps/user_api/accounts/tests/test_views.py b/openedx/core/djangoapps/user_api/accounts/tests/test_views.py index 11ed48343144f65d4190704f33e19c68d8d1e616..b4d2d7dd6db7f89ff33ff05d06ebb12172f4b30c 100644 --- a/openedx/core/djangoapps/user_api/accounts/tests/test_views.py +++ b/openedx/core/djangoapps/user_api/accounts/tests/test_views.py @@ -552,7 +552,7 @@ class TestAccountsAPI(CacheIsolationTestCase, UserAPITestCase): ("country", "GB", "XY", u'"XY" is not a valid choice.'), ("year_of_birth", 2009, "not_an_int", u"A valid integer is required."), ("name", "bob", "z" * 256, u"Ensure this value has at most 255 characters (it has 256)."), - ("name", u"ȻħȺÉłɇs", "z ", u"The name field must be at least 2 characters long."), + ("name", u"ȻħȺÉłɇs", " ", u"The name field must be at least 1 character long."), ("goals", "Smell the roses"), ("mailing_address", "Sesame Street"), # Note that we store the raw data, so it is up to client to escape the HTML. diff --git a/openedx/core/djangoapps/user_authn/views/tests/test_register.py b/openedx/core/djangoapps/user_authn/views/tests/test_register.py index 273d0d1ef986d9cd8e3c4c1134c3846d060394e5..94f71b1abe9a7ba3c41ee1202bae1629e832515b 100644 --- a/openedx/core/djangoapps/user_authn/views/tests/test_register.py +++ b/openedx/core/djangoapps/user_authn/views/tests/test_register.py @@ -658,12 +658,11 @@ class TestCreateAccountValidation(TestCase): # Missing del params["name"] - assert_name_error("Your legal name must be a minimum of two characters long") + assert_name_error("Your legal name must be a minimum of one character long") # Empty, too short - for name in ["", "a"]: - params["name"] = name - assert_name_error("Your legal name must be a minimum of two characters long") + params["name"] = "" + assert_name_error("Your legal name must be a minimum of one character long") def test_honor_code(self): params = dict(self.minimal_params)