diff --git a/src/core/forms.py b/src/core/forms.py index 7049ffc0aa3b516ad7cfa1a9f1f86aa5acb97993..5e4f619ec4710069f8c62e6d42c82a1a0615ed45 100644 --- a/src/core/forms.py +++ b/src/core/forms.py @@ -130,6 +130,8 @@ class RegistrationForm(UserCreationForm): def clean(self): if self.request and self.request.limited: raise ValidationError(_('Registration__rate-limited')) + if (username := self.cleaned_data.get('username')) and username.startswith('_'): + raise ValidationError({'username': _('Registration__username__nounderscore')}) return super().clean() def send_mail( diff --git a/src/core/locale/de/LC_MESSAGES/django.po b/src/core/locale/de/LC_MESSAGES/django.po index 983a986aba2ce99f648bffe1b91ebecbbe5a83d5..d4368df364e92fd7dd717f13d7199b25aa356c3a 100644 --- a/src/core/locale/de/LC_MESSAGES/django.po +++ b/src/core/locale/de/LC_MESSAGES/django.po @@ -131,6 +131,9 @@ msgstr "Deine Kontakt Email für diese Veranstaltung (nicht öffentlich)" msgid "Registration__rate-limited" msgstr "Zu viele Request (Rate-Limited), bitte einen Moment warten!" +msgid "Registration__username__nounderscore" +msgstr "Der Benutzername darf nicht mit einem Unterstrich beginnen." + msgid "Tags" msgstr "" diff --git a/src/core/locale/en/LC_MESSAGES/django.po b/src/core/locale/en/LC_MESSAGES/django.po index 8cde7d22c0cf1e1635943ca7c4446a9128cd8d24..1f76e189fbe58f80bd285da6616c0bccb82f74ef 100644 --- a/src/core/locale/en/LC_MESSAGES/django.po +++ b/src/core/locale/en/LC_MESSAGES/django.po @@ -131,6 +131,9 @@ msgstr "Your contact email for this event (not public)" msgid "Registration__rate-limited" msgstr "Too many requests (Rate-Limited), please wait a moment!" +msgid "Registration__username__nounderscore" +msgstr "The username must not begin with an underscore." + msgid "Tags" msgstr ""