Skip to content
Snippets Groups Projects
Commit 4aefab21 authored by HeJ's avatar HeJ
Browse files

registration: disallow usernames starting with an underscore

parent a05f5d70
No related branches found
No related tags found
No related merge requests found
......@@ -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(
......
......@@ -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 ""
......
......@@ -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 ""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment