From e96ab2e4755fefdc2e975a873367a9911f13e5fe Mon Sep 17 00:00:00 2001 From: Christoph Meissner Date: Fri, 25 Mar 2022 20:48:09 +0100 Subject: [PATCH 1/6] Restrict new usernames New users may only select usernames following this rules: * min 3, max 16 characters * starts with an letter and ends with an letter or number * may only contain [a-zA-Z0-9_.] fixes #494 --- accounts/forms.py | 49 ++++++ locale/ar/LC_MESSAGES/django.po | 14 +- locale/bg/LC_MESSAGES/django.po | 14 +- locale/cs/LC_MESSAGES/django.po | 14 +- locale/da/LC_MESSAGES/django.po | 14 +- locale/de/LC_MESSAGES/django.po | 14 +- locale/el/LC_MESSAGES/django.po | 14 +- locale/en/LC_MESSAGES/django.po | 14 +- locale/es/LC_MESSAGES/django.po | 14 +- locale/es_MX/LC_MESSAGES/django.po | 14 +- locale/fa/LC_MESSAGES/django.po | 14 +- locale/fr/LC_MESSAGES/django.po | 14 +- locale/hr/LC_MESSAGES/django.po | 14 +- locale/hu/LC_MESSAGES/django.po | 14 +- locale/hy/LC_MESSAGES/django.po | 14 +- locale/it/LC_MESSAGES/django.po | 14 +- locale/nl/LC_MESSAGES/django.po | 14 +- locale/no/LC_MESSAGES/django.po | 14 +- locale/pl/LC_MESSAGES/django.po | 14 +- locale/pt/LC_MESSAGES/django.po | 14 +- locale/pt_BR/LC_MESSAGES/django.po | 14 +- locale/ro/LC_MESSAGES/django.po | 14 +- locale/ru/LC_MESSAGES/django.po | 14 +- locale/sk/LC_MESSAGES/django.po | 14 +- locale/sl/LC_MESSAGES/django.po | 14 +- locale/sq/LC_MESSAGES/django.po | 14 +- locale/sr_RS/LC_MESSAGES/django.po | 14 +- locale/sv/LC_MESSAGES/django.po | 14 +- locale/tr/LC_MESSAGES/django.po | 14 +- locale/tr_TR/LC_MESSAGES/django.po | 14 +- locale/uk/LC_MESSAGES/django.po | 14 +- locale/zh_CN/LC_MESSAGES/django.po | 14 +- templates/registration/registration_form.html | 4 +- tests/registration/test_registration.py | 159 ++++++++++++++++-- 34 files changed, 603 insertions(+), 43 deletions(-) diff --git a/accounts/forms.py b/accounts/forms.py index a9db15b0..47de5150 100644 --- a/accounts/forms.py +++ b/accounts/forms.py @@ -1,9 +1,58 @@ from django import forms +from django.core.validators import RegexValidator from django.utils.text import gettext_lazy as _ + from registration.forms import RegistrationFormUniqueEmail +username_first_char_validator = RegexValidator( + r"^[a-zA-Z]", _("Username must start with a letter.") +) +username_validator = RegexValidator( + r"^[a-zA-Z0-9_.]*$", + _('Invalid username. Allowed characters are letters, numbers, "." and "_".'), +) +username_last_char_validator = RegexValidator( + r"[a-zA-Z0-9]$", _("Username must end with a letter or a number.") +) +no_consequtive_dots = RegexValidator( + r"\.\.", + _("Username must not contain consecutive . or _ characters."), + inverse_match=True, +) +no_consequtive_underscores = RegexValidator( + r"__", + _("Username must not contain consecutive . or _ characters."), + inverse_match=True, +) +no_consequtive_funnystuff = RegexValidator( + r"_\.", + _("Username must not contain consecutive . or _ characters."), + inverse_match=True, +) +no_consequtive_funnystuff2 = RegexValidator( + r"\._", + _("Username must not contain consecutive . or _ characters."), + inverse_match=True, +) + class RegistrationForm(RegistrationFormUniqueEmail): + + username = forms.CharField( + max_length=16, + min_length=3, + strip=False, + validators=[ + username_first_char_validator, + username_validator, + username_last_char_validator, + no_consequtive_dots, + no_consequtive_underscores, + no_consequtive_funnystuff, + no_consequtive_funnystuff2, + ], + ) + accept_privacy_policy = forms.BooleanField( required=True, initial=False, label=_("Accept privacy policy") ) diff --git a/locale/ar/LC_MESSAGES/django.po b/locale/ar/LC_MESSAGES/django.po index 8ca8a457..a141a40e 100644 --- a/locale/ar/LC_MESSAGES/django.po +++ b/locale/ar/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-25 11:54+0100\n" +"POT-Creation-Date: 2022-03-25 21:54+0100\n" "PO-Revision-Date: 2022-03-15 17:56+0000\n" "Last-Translator: Christoph Meißner\n" "Language-Team: Arabic (http://www.transifex.com/coders4help/volunteer-planner/language/ar/)\n" @@ -36,6 +36,18 @@ msgstr "" msgid "Accounts" msgstr "الحسابات " +msgid "Username must start with a letter." +msgstr "" + +msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." +msgstr "" + +msgid "Username must end with a letter or a number." +msgstr "" + +msgid "Username must not contain consecutive . or _ characters." +msgstr "" + msgid "Accept privacy policy" msgstr "" diff --git a/locale/bg/LC_MESSAGES/django.po b/locale/bg/LC_MESSAGES/django.po index 4c88cd9d..766467e5 100644 --- a/locale/bg/LC_MESSAGES/django.po +++ b/locale/bg/LC_MESSAGES/django.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-25 11:54+0100\n" +"POT-Creation-Date: 2022-03-25 21:54+0100\n" "PO-Revision-Date: 2022-03-15 17:56+0000\n" "Last-Translator: Christoph Meißner\n" "Language-Team: Bulgarian (http://www.transifex.com/coders4help/volunteer-planner/language/bg/)\n" @@ -32,6 +32,18 @@ msgstr "" msgid "Accounts" msgstr "" +msgid "Username must start with a letter." +msgstr "" + +msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." +msgstr "" + +msgid "Username must end with a letter or a number." +msgstr "" + +msgid "Username must not contain consecutive . or _ characters." +msgstr "" + msgid "Accept privacy policy" msgstr "" diff --git a/locale/cs/LC_MESSAGES/django.po b/locale/cs/LC_MESSAGES/django.po index c7108a00..a2c4814b 100644 --- a/locale/cs/LC_MESSAGES/django.po +++ b/locale/cs/LC_MESSAGES/django.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-25 11:54+0100\n" +"POT-Creation-Date: 2022-03-25 21:54+0100\n" "PO-Revision-Date: 2022-03-15 17:56+0000\n" "Last-Translator: Christoph Meißner\n" "Language-Team: Czech (http://www.transifex.com/coders4help/volunteer-planner/language/cs/)\n" @@ -34,6 +34,18 @@ msgstr "poslední přihlášení" msgid "Accounts" msgstr "Účty" +msgid "Username must start with a letter." +msgstr "" + +msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." +msgstr "" + +msgid "Username must end with a letter or a number." +msgstr "" + +msgid "Username must not contain consecutive . or _ characters." +msgstr "" + msgid "Accept privacy policy" msgstr "Přijmout zásady ochrany osobních údajů" diff --git a/locale/da/LC_MESSAGES/django.po b/locale/da/LC_MESSAGES/django.po index 8d1a61f4..e767a6ad 100644 --- a/locale/da/LC_MESSAGES/django.po +++ b/locale/da/LC_MESSAGES/django.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-25 11:54+0100\n" +"POT-Creation-Date: 2022-03-25 21:54+0100\n" "PO-Revision-Date: 2017-09-22 15:35+0000\n" "Last-Translator: Dorian Cantzen \n" "Language-Team: Danish (http://www.transifex.com/coders4help/volunteer-planner/language/da/)\n" @@ -33,6 +33,18 @@ msgstr "" msgid "Accounts" msgstr "" +msgid "Username must start with a letter." +msgstr "" + +msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." +msgstr "" + +msgid "Username must end with a letter or a number." +msgstr "" + +msgid "Username must not contain consecutive . or _ characters." +msgstr "" + msgid "Accept privacy policy" msgstr "" diff --git a/locale/de/LC_MESSAGES/django.po b/locale/de/LC_MESSAGES/django.po index a6573dc8..135a4116 100644 --- a/locale/de/LC_MESSAGES/django.po +++ b/locale/de/LC_MESSAGES/django.po @@ -19,7 +19,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-25 11:54+0100\n" +"POT-Creation-Date: 2022-03-25 21:54+0100\n" "PO-Revision-Date: 2016-11-21 18:24+0000\n" "Last-Translator: Sönke Klinger \n" "Language-Team: German (http://www.transifex.com/coders4help/volunteer-planner/language/de/)\n" @@ -47,6 +47,18 @@ msgstr "Letzte Anmeldung" msgid "Accounts" msgstr "Benutzerkonten" +msgid "Username must start with a letter." +msgstr "Benutzername muss mit einem Buchstaben anfangen." + +msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." +msgstr "Ungültiger Benutzername. Erlaubte Zeichen sind Buchstaben, Ziffern, \".\" and \".\"." + +msgid "Username must end with a letter or a number." +msgstr "Benutzername muss mit einem Buchstaben oder einer Ziffer enden." + +msgid "Username must not contain consecutive . or _ characters." +msgstr "Benutzername darf keine aufeinanderfolgenden . oder _ enthalten." + msgid "Accept privacy policy" msgstr "Einwilligung (nach Art 6 Abs 1 Satz 1 a DSGVO)" diff --git a/locale/el/LC_MESSAGES/django.po b/locale/el/LC_MESSAGES/django.po index a80aad5f..640ad598 100644 --- a/locale/el/LC_MESSAGES/django.po +++ b/locale/el/LC_MESSAGES/django.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-25 11:54+0100\n" +"POT-Creation-Date: 2022-03-25 21:54+0100\n" "PO-Revision-Date: 2016-01-29 08:23+0000\n" "Last-Translator: Dorian Cantzen \n" "Language-Team: Greek (http://www.transifex.com/coders4help/volunteer-planner/language/el/)\n" @@ -37,6 +37,18 @@ msgstr "" msgid "Accounts" msgstr "Λογαριασμοί" +msgid "Username must start with a letter." +msgstr "" + +msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." +msgstr "" + +msgid "Username must end with a letter or a number." +msgstr "" + +msgid "Username must not contain consecutive . or _ characters." +msgstr "" + msgid "Accept privacy policy" msgstr "" diff --git a/locale/en/LC_MESSAGES/django.po b/locale/en/LC_MESSAGES/django.po index c4886c53..bcc9d0c5 100644 --- a/locale/en/LC_MESSAGES/django.po +++ b/locale/en/LC_MESSAGES/django.po @@ -2,7 +2,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-25 11:54+0100\n" +"POT-Creation-Date: 2022-03-25 21:54+0100\n" "PO-Revision-Date: 2015-10-04 21:53+0000\n" "Last-Translator: Dorian Cantzen \n" "Language-Team: English (http://www.transifex.com/coders4help/volunteer-planner/language/en/)\n" @@ -29,6 +29,18 @@ msgstr "" msgid "Accounts" msgstr "" +msgid "Username must start with a letter." +msgstr "" + +msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." +msgstr "" + +msgid "Username must end with a letter or a number." +msgstr "" + +msgid "Username must not contain consecutive . or _ characters." +msgstr "" + msgid "Accept privacy policy" msgstr "" diff --git a/locale/es/LC_MESSAGES/django.po b/locale/es/LC_MESSAGES/django.po index eb4cd93f..ff5d2e6b 100644 --- a/locale/es/LC_MESSAGES/django.po +++ b/locale/es/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-25 11:54+0100\n" +"POT-Creation-Date: 2022-03-25 21:54+0100\n" "PO-Revision-Date: 2016-04-13 17:27+0000\n" "Last-Translator: Antonio Mireles \n" "Language-Team: Spanish (http://www.transifex.com/coders4help/volunteer-planner/language/es/)\n" @@ -36,6 +36,18 @@ msgstr "" msgid "Accounts" msgstr "Cuentas" +msgid "Username must start with a letter." +msgstr "" + +msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." +msgstr "" + +msgid "Username must end with a letter or a number." +msgstr "" + +msgid "Username must not contain consecutive . or _ characters." +msgstr "" + msgid "Accept privacy policy" msgstr "" diff --git a/locale/es_MX/LC_MESSAGES/django.po b/locale/es_MX/LC_MESSAGES/django.po index 8ee78541..fe78cd39 100644 --- a/locale/es_MX/LC_MESSAGES/django.po +++ b/locale/es_MX/LC_MESSAGES/django.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-25 11:54+0100\n" +"POT-Creation-Date: 2022-03-25 21:54+0100\n" "PO-Revision-Date: 2015-09-24 12:23+0000\n" "Last-Translator: Dorian Cantzen \n" "Language-Team: Spanish (Mexico) (http://www.transifex.com/coders4help/volunteer-planner/language/es_MX/)\n" @@ -32,6 +32,18 @@ msgstr "" msgid "Accounts" msgstr "" +msgid "Username must start with a letter." +msgstr "" + +msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." +msgstr "" + +msgid "Username must end with a letter or a number." +msgstr "" + +msgid "Username must not contain consecutive . or _ characters." +msgstr "" + msgid "Accept privacy policy" msgstr "" diff --git a/locale/fa/LC_MESSAGES/django.po b/locale/fa/LC_MESSAGES/django.po index 39111c38..77ddf0d9 100644 --- a/locale/fa/LC_MESSAGES/django.po +++ b/locale/fa/LC_MESSAGES/django.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-25 11:54+0100\n" +"POT-Creation-Date: 2022-03-25 21:54+0100\n" "PO-Revision-Date: 2016-01-29 08:23+0000\n" "Last-Translator: Dorian Cantzen \n" "Language-Team: Persian (http://www.transifex.com/coders4help/volunteer-planner/language/fa/)\n" @@ -32,6 +32,18 @@ msgstr "" msgid "Accounts" msgstr "" +msgid "Username must start with a letter." +msgstr "" + +msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." +msgstr "" + +msgid "Username must end with a letter or a number." +msgstr "" + +msgid "Username must not contain consecutive . or _ characters." +msgstr "" + msgid "Accept privacy policy" msgstr "" diff --git a/locale/fr/LC_MESSAGES/django.po b/locale/fr/LC_MESSAGES/django.po index 82d9dc2a..2cbea4e7 100644 --- a/locale/fr/LC_MESSAGES/django.po +++ b/locale/fr/LC_MESSAGES/django.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-25 11:54+0100\n" +"POT-Creation-Date: 2022-03-25 21:54+0100\n" "PO-Revision-Date: 2016-12-08 20:50+0000\n" "Last-Translator: Dolfeus \n" "Language-Team: French (http://www.transifex.com/coders4help/volunteer-planner/language/fr/)\n" @@ -38,6 +38,18 @@ msgstr "" msgid "Accounts" msgstr "Comptes utilisateur" +msgid "Username must start with a letter." +msgstr "" + +msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." +msgstr "" + +msgid "Username must end with a letter or a number." +msgstr "" + +msgid "Username must not contain consecutive . or _ characters." +msgstr "" + msgid "Accept privacy policy" msgstr "" diff --git a/locale/hr/LC_MESSAGES/django.po b/locale/hr/LC_MESSAGES/django.po index 9ce2b83d..37009e2b 100644 --- a/locale/hr/LC_MESSAGES/django.po +++ b/locale/hr/LC_MESSAGES/django.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-25 11:54+0100\n" +"POT-Creation-Date: 2022-03-25 21:54+0100\n" "PO-Revision-Date: 2016-01-29 08:23+0000\n" "Last-Translator: Dorian Cantzen \n" "Language-Team: Croatian (http://www.transifex.com/coders4help/volunteer-planner/language/hr/)\n" @@ -32,6 +32,18 @@ msgstr "" msgid "Accounts" msgstr "" +msgid "Username must start with a letter." +msgstr "" + +msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." +msgstr "" + +msgid "Username must end with a letter or a number." +msgstr "" + +msgid "Username must not contain consecutive . or _ characters." +msgstr "" + msgid "Accept privacy policy" msgstr "" diff --git a/locale/hu/LC_MESSAGES/django.po b/locale/hu/LC_MESSAGES/django.po index 4700142a..c79e58ac 100644 --- a/locale/hu/LC_MESSAGES/django.po +++ b/locale/hu/LC_MESSAGES/django.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-25 11:54+0100\n" +"POT-Creation-Date: 2022-03-25 21:54+0100\n" "PO-Revision-Date: 2016-01-29 08:23+0000\n" "Last-Translator: Dorian Cantzen \n" "Language-Team: Hungarian (http://www.transifex.com/coders4help/volunteer-planner/language/hu/)\n" @@ -42,6 +42,18 @@ msgstr "" msgid "Accounts" msgstr "" +msgid "Username must start with a letter." +msgstr "" + +msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." +msgstr "" + +msgid "Username must end with a letter or a number." +msgstr "" + +msgid "Username must not contain consecutive . or _ characters." +msgstr "" + msgid "Accept privacy policy" msgstr "" diff --git a/locale/hy/LC_MESSAGES/django.po b/locale/hy/LC_MESSAGES/django.po index 6ad5090e..c79349f3 100644 --- a/locale/hy/LC_MESSAGES/django.po +++ b/locale/hy/LC_MESSAGES/django.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-25 11:54+0100\n" +"POT-Creation-Date: 2022-03-25 21:54+0100\n" "PO-Revision-Date: 2015-09-24 12:23+0000\n" "Last-Translator: Dorian Cantzen \n" "Language-Team: Armenian (http://www.transifex.com/coders4help/volunteer-planner/language/hy/)\n" @@ -32,6 +32,18 @@ msgstr "" msgid "Accounts" msgstr "" +msgid "Username must start with a letter." +msgstr "" + +msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." +msgstr "" + +msgid "Username must end with a letter or a number." +msgstr "" + +msgid "Username must not contain consecutive . or _ characters." +msgstr "" + msgid "Accept privacy policy" msgstr "" diff --git a/locale/it/LC_MESSAGES/django.po b/locale/it/LC_MESSAGES/django.po index 97e5d5e6..08efeb03 100644 --- a/locale/it/LC_MESSAGES/django.po +++ b/locale/it/LC_MESSAGES/django.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-25 11:54+0100\n" +"POT-Creation-Date: 2022-03-25 21:54+0100\n" "PO-Revision-Date: 2016-01-29 08:23+0000\n" "Last-Translator: Dorian Cantzen \n" "Language-Team: Italian (http://www.transifex.com/coders4help/volunteer-planner/language/it/)\n" @@ -32,6 +32,18 @@ msgstr "" msgid "Accounts" msgstr "" +msgid "Username must start with a letter." +msgstr "" + +msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." +msgstr "" + +msgid "Username must end with a letter or a number." +msgstr "" + +msgid "Username must not contain consecutive . or _ characters." +msgstr "" + msgid "Accept privacy policy" msgstr "" diff --git a/locale/nl/LC_MESSAGES/django.po b/locale/nl/LC_MESSAGES/django.po index fc9f8851..4a110c3e 100644 --- a/locale/nl/LC_MESSAGES/django.po +++ b/locale/nl/LC_MESSAGES/django.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-25 11:54+0100\n" +"POT-Creation-Date: 2022-03-25 21:54+0100\n" "PO-Revision-Date: 2016-01-29 08:23+0000\n" "Last-Translator: Dorian Cantzen \n" "Language-Team: Dutch (http://www.transifex.com/coders4help/volunteer-planner/language/nl/)\n" @@ -32,6 +32,18 @@ msgstr "" msgid "Accounts" msgstr "" +msgid "Username must start with a letter." +msgstr "" + +msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." +msgstr "" + +msgid "Username must end with a letter or a number." +msgstr "" + +msgid "Username must not contain consecutive . or _ characters." +msgstr "" + msgid "Accept privacy policy" msgstr "" diff --git a/locale/no/LC_MESSAGES/django.po b/locale/no/LC_MESSAGES/django.po index 36b1b832..7bacae08 100644 --- a/locale/no/LC_MESSAGES/django.po +++ b/locale/no/LC_MESSAGES/django.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-25 11:54+0100\n" +"POT-Creation-Date: 2022-03-25 21:54+0100\n" "PO-Revision-Date: 2016-01-29 08:23+0000\n" "Last-Translator: Dorian Cantzen \n" "Language-Team: Norwegian (http://www.transifex.com/coders4help/volunteer-planner/language/no/)\n" @@ -32,6 +32,18 @@ msgstr "" msgid "Accounts" msgstr "" +msgid "Username must start with a letter." +msgstr "" + +msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." +msgstr "" + +msgid "Username must end with a letter or a number." +msgstr "" + +msgid "Username must not contain consecutive . or _ characters." +msgstr "" + msgid "Accept privacy policy" msgstr "" diff --git a/locale/pl/LC_MESSAGES/django.po b/locale/pl/LC_MESSAGES/django.po index 3cbe99a2..5735d151 100644 --- a/locale/pl/LC_MESSAGES/django.po +++ b/locale/pl/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-25 11:54+0100\n" +"POT-Creation-Date: 2022-03-25 21:54+0100\n" "PO-Revision-Date: 2017-09-22 15:29+0000\n" "Last-Translator: Dorian Cantzen \n" "Language-Team: Polish (http://www.transifex.com/coders4help/volunteer-planner/language/pl/)\n" @@ -36,6 +36,18 @@ msgstr "" msgid "Accounts" msgstr "" +msgid "Username must start with a letter." +msgstr "" + +msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." +msgstr "" + +msgid "Username must end with a letter or a number." +msgstr "" + +msgid "Username must not contain consecutive . or _ characters." +msgstr "" + msgid "Accept privacy policy" msgstr "" diff --git a/locale/pt/LC_MESSAGES/django.po b/locale/pt/LC_MESSAGES/django.po index 481a264e..265bdf6d 100644 --- a/locale/pt/LC_MESSAGES/django.po +++ b/locale/pt/LC_MESSAGES/django.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-25 11:54+0100\n" +"POT-Creation-Date: 2022-03-25 21:54+0100\n" "PO-Revision-Date: 2016-01-29 08:23+0000\n" "Last-Translator: Dorian Cantzen \n" "Language-Team: Portuguese (http://www.transifex.com/coders4help/volunteer-planner/language/pt/)\n" @@ -37,6 +37,18 @@ msgstr "" msgid "Accounts" msgstr "Contas" +msgid "Username must start with a letter." +msgstr "" + +msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." +msgstr "" + +msgid "Username must end with a letter or a number." +msgstr "" + +msgid "Username must not contain consecutive . or _ characters." +msgstr "" + msgid "Accept privacy policy" msgstr "" diff --git a/locale/pt_BR/LC_MESSAGES/django.po b/locale/pt_BR/LC_MESSAGES/django.po index 6d54b76d..1a16d097 100644 --- a/locale/pt_BR/LC_MESSAGES/django.po +++ b/locale/pt_BR/LC_MESSAGES/django.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-25 11:54+0100\n" +"POT-Creation-Date: 2022-03-25 21:54+0100\n" "PO-Revision-Date: 2015-09-24 12:23+0000\n" "Last-Translator: Dorian Cantzen \n" "Language-Team: Portuguese (Brazil) (http://www.transifex.com/coders4help/volunteer-planner/language/pt_BR/)\n" @@ -32,6 +32,18 @@ msgstr "" msgid "Accounts" msgstr "" +msgid "Username must start with a letter." +msgstr "" + +msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." +msgstr "" + +msgid "Username must end with a letter or a number." +msgstr "" + +msgid "Username must not contain consecutive . or _ characters." +msgstr "" + msgid "Accept privacy policy" msgstr "" diff --git a/locale/ro/LC_MESSAGES/django.po b/locale/ro/LC_MESSAGES/django.po index 52aa6eb5..d4fc15db 100644 --- a/locale/ro/LC_MESSAGES/django.po +++ b/locale/ro/LC_MESSAGES/django.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-25 11:54+0100\n" +"POT-Creation-Date: 2022-03-25 21:54+0100\n" "PO-Revision-Date: 2016-01-29 08:23+0000\n" "Last-Translator: Dorian Cantzen \n" "Language-Team: Romanian (http://www.transifex.com/coders4help/volunteer-planner/language/ro/)\n" @@ -32,6 +32,18 @@ msgstr "" msgid "Accounts" msgstr "" +msgid "Username must start with a letter." +msgstr "" + +msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." +msgstr "" + +msgid "Username must end with a letter or a number." +msgstr "" + +msgid "Username must not contain consecutive . or _ characters." +msgstr "" + msgid "Accept privacy policy" msgstr "" diff --git a/locale/ru/LC_MESSAGES/django.po b/locale/ru/LC_MESSAGES/django.po index 855b5612..ef35bc32 100644 --- a/locale/ru/LC_MESSAGES/django.po +++ b/locale/ru/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-25 11:54+0100\n" +"POT-Creation-Date: 2022-03-25 21:54+0100\n" "PO-Revision-Date: 2022-03-10 13:42+0000\n" "Last-Translator: Anna Dunn\n" "Language-Team: Russian (http://www.transifex.com/coders4help/volunteer-planner/language/ru/)\n" @@ -36,6 +36,18 @@ msgstr "" msgid "Accounts" msgstr "Aккаунты" +msgid "Username must start with a letter." +msgstr "" + +msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." +msgstr "" + +msgid "Username must end with a letter or a number." +msgstr "" + +msgid "Username must not contain consecutive . or _ characters." +msgstr "" + msgid "Accept privacy policy" msgstr "" diff --git a/locale/sk/LC_MESSAGES/django.po b/locale/sk/LC_MESSAGES/django.po index b043e39d..9d0731b0 100644 --- a/locale/sk/LC_MESSAGES/django.po +++ b/locale/sk/LC_MESSAGES/django.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-25 11:54+0100\n" +"POT-Creation-Date: 2022-03-25 21:54+0100\n" "PO-Revision-Date: 2016-01-29 08:23+0000\n" "Last-Translator: Dorian Cantzen \n" "Language-Team: Slovak (http://www.transifex.com/coders4help/volunteer-planner/language/sk/)\n" @@ -32,6 +32,18 @@ msgstr "" msgid "Accounts" msgstr "" +msgid "Username must start with a letter." +msgstr "" + +msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." +msgstr "" + +msgid "Username must end with a letter or a number." +msgstr "" + +msgid "Username must not contain consecutive . or _ characters." +msgstr "" + msgid "Accept privacy policy" msgstr "" diff --git a/locale/sl/LC_MESSAGES/django.po b/locale/sl/LC_MESSAGES/django.po index 5551e559..2c2773c4 100644 --- a/locale/sl/LC_MESSAGES/django.po +++ b/locale/sl/LC_MESSAGES/django.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-25 11:54+0100\n" +"POT-Creation-Date: 2022-03-25 21:54+0100\n" "PO-Revision-Date: 2016-01-29 08:23+0000\n" "Last-Translator: Dorian Cantzen \n" "Language-Team: Slovenian (http://www.transifex.com/coders4help/volunteer-planner/language/sl/)\n" @@ -32,6 +32,18 @@ msgstr "" msgid "Accounts" msgstr "" +msgid "Username must start with a letter." +msgstr "" + +msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." +msgstr "" + +msgid "Username must end with a letter or a number." +msgstr "" + +msgid "Username must not contain consecutive . or _ characters." +msgstr "" + msgid "Accept privacy policy" msgstr "" diff --git a/locale/sq/LC_MESSAGES/django.po b/locale/sq/LC_MESSAGES/django.po index 17c24c2c..e25b8429 100644 --- a/locale/sq/LC_MESSAGES/django.po +++ b/locale/sq/LC_MESSAGES/django.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-25 11:54+0100\n" +"POT-Creation-Date: 2022-03-25 21:54+0100\n" "PO-Revision-Date: 2016-01-29 08:23+0000\n" "Last-Translator: Dorian Cantzen \n" "Language-Team: Albanian (http://www.transifex.com/coders4help/volunteer-planner/language/sq/)\n" @@ -32,6 +32,18 @@ msgstr "" msgid "Accounts" msgstr "" +msgid "Username must start with a letter." +msgstr "" + +msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." +msgstr "" + +msgid "Username must end with a letter or a number." +msgstr "" + +msgid "Username must not contain consecutive . or _ characters." +msgstr "" + msgid "Accept privacy policy" msgstr "" diff --git a/locale/sr_RS/LC_MESSAGES/django.po b/locale/sr_RS/LC_MESSAGES/django.po index 9ce8a907..7f1de3ab 100644 --- a/locale/sr_RS/LC_MESSAGES/django.po +++ b/locale/sr_RS/LC_MESSAGES/django.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-25 11:54+0100\n" +"POT-Creation-Date: 2022-03-25 21:54+0100\n" "PO-Revision-Date: 2016-01-29 08:23+0000\n" "Last-Translator: Dorian Cantzen \n" "Language-Team: Serbian (Serbia) (http://www.transifex.com/coders4help/volunteer-planner/language/sr_RS/)\n" @@ -32,6 +32,18 @@ msgstr "" msgid "Accounts" msgstr "" +msgid "Username must start with a letter." +msgstr "" + +msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." +msgstr "" + +msgid "Username must end with a letter or a number." +msgstr "" + +msgid "Username must not contain consecutive . or _ characters." +msgstr "" + msgid "Accept privacy policy" msgstr "" diff --git a/locale/sv/LC_MESSAGES/django.po b/locale/sv/LC_MESSAGES/django.po index 80d22e48..97ac24ad 100644 --- a/locale/sv/LC_MESSAGES/django.po +++ b/locale/sv/LC_MESSAGES/django.po @@ -11,7 +11,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-25 11:54+0100\n" +"POT-Creation-Date: 2022-03-25 21:54+0100\n" "PO-Revision-Date: 2016-01-29 08:23+0000\n" "Last-Translator: Dorian Cantzen \n" "Language-Team: Swedish (http://www.transifex.com/coders4help/volunteer-planner/language/sv/)\n" @@ -39,6 +39,18 @@ msgstr "" msgid "Accounts" msgstr "Konton" +msgid "Username must start with a letter." +msgstr "" + +msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." +msgstr "" + +msgid "Username must end with a letter or a number." +msgstr "" + +msgid "Username must not contain consecutive . or _ characters." +msgstr "" + msgid "Accept privacy policy" msgstr "" diff --git a/locale/tr/LC_MESSAGES/django.po b/locale/tr/LC_MESSAGES/django.po index 954760c0..c33fb0f1 100644 --- a/locale/tr/LC_MESSAGES/django.po +++ b/locale/tr/LC_MESSAGES/django.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-25 11:54+0100\n" +"POT-Creation-Date: 2022-03-25 21:54+0100\n" "PO-Revision-Date: 2016-01-29 08:23+0000\n" "Last-Translator: Dorian Cantzen \n" "Language-Team: Turkish (http://www.transifex.com/coders4help/volunteer-planner/language/tr/)\n" @@ -33,6 +33,18 @@ msgstr "" msgid "Accounts" msgstr "" +msgid "Username must start with a letter." +msgstr "" + +msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." +msgstr "" + +msgid "Username must end with a letter or a number." +msgstr "" + +msgid "Username must not contain consecutive . or _ characters." +msgstr "" + msgid "Accept privacy policy" msgstr "" diff --git a/locale/tr_TR/LC_MESSAGES/django.po b/locale/tr_TR/LC_MESSAGES/django.po index 92bd0065..a189373f 100644 --- a/locale/tr_TR/LC_MESSAGES/django.po +++ b/locale/tr_TR/LC_MESSAGES/django.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-25 11:54+0100\n" +"POT-Creation-Date: 2022-03-25 21:54+0100\n" "PO-Revision-Date: 2015-09-24 12:23+0000\n" "Last-Translator: Dorian Cantzen \n" "Language-Team: Turkish (Turkey) (http://www.transifex.com/coders4help/volunteer-planner/language/tr_TR/)\n" @@ -32,6 +32,18 @@ msgstr "" msgid "Accounts" msgstr "" +msgid "Username must start with a letter." +msgstr "" + +msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." +msgstr "" + +msgid "Username must end with a letter or a number." +msgstr "" + +msgid "Username must not contain consecutive . or _ characters." +msgstr "" + msgid "Accept privacy policy" msgstr "" diff --git a/locale/uk/LC_MESSAGES/django.po b/locale/uk/LC_MESSAGES/django.po index d0fea91c..9f9ad1a8 100644 --- a/locale/uk/LC_MESSAGES/django.po +++ b/locale/uk/LC_MESSAGES/django.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-25 11:54+0100\n" +"POT-Creation-Date: 2022-03-25 21:54+0100\n" "PO-Revision-Date: 2015-09-24 12:23+0000\n" "Last-Translator: Dorian Cantzen \n" "Language-Team: Ukrainian (http://www.transifex.com/coders4help/volunteer-planner/language/uk/)\n" @@ -32,6 +32,18 @@ msgstr "" msgid "Accounts" msgstr "" +msgid "Username must start with a letter." +msgstr "" + +msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." +msgstr "" + +msgid "Username must end with a letter or a number." +msgstr "" + +msgid "Username must not contain consecutive . or _ characters." +msgstr "" + msgid "Accept privacy policy" msgstr "" diff --git a/locale/zh_CN/LC_MESSAGES/django.po b/locale/zh_CN/LC_MESSAGES/django.po index 1bfe8925..7043b7a1 100644 --- a/locale/zh_CN/LC_MESSAGES/django.po +++ b/locale/zh_CN/LC_MESSAGES/django.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-25 11:54+0100\n" +"POT-Creation-Date: 2022-03-25 21:54+0100\n" "PO-Revision-Date: 2015-09-24 12:23+0000\n" "Last-Translator: Dorian Cantzen \n" "Language-Team: Chinese (China) (http://www.transifex.com/coders4help/volunteer-planner/language/zh_CN/)\n" @@ -32,6 +32,18 @@ msgstr "" msgid "Accounts" msgstr "" +msgid "Username must start with a letter." +msgstr "" + +msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." +msgstr "" + +msgid "Username must end with a letter or a number." +msgstr "" + +msgid "Username must not contain consecutive . or _ characters." +msgstr "" + msgid "Accept privacy policy" msgstr "" diff --git a/templates/registration/registration_form.html b/templates/registration/registration_form.html index 745cdbe1..293b721c 100644 --- a/templates/registration/registration_form.html +++ b/templates/registration/registration_form.html @@ -24,7 +24,7 @@

{% trans "Create a new account" %}

class="form-control" placeholder="{% trans "Email" %}" name="email" - value="{{ form.cleaned_data.email }}"> + value="{{ form.cleaned_data.email|default:form.email.value }}">

{% trans "Volunteer-Planner and shelters will send you emails concerning your shifts." %}

@@ -39,7 +39,7 @@

{% trans "Create a new account" %}

id="Username" placeholder="{% trans "Username" %}" name="username" - value="{{ form.cleaned_data.username }}"> + value="{{ form.cleaned_data.username|default:form.username.value }}">

{% trans "Your username will be visible to other users. Don't use spaces or special characters." %}

diff --git a/tests/registration/test_registration.py b/tests/registration/test_registration.py index 3f57e226..11f03df4 100644 --- a/tests/registration/test_registration.py +++ b/tests/registration/test_registration.py @@ -10,7 +10,6 @@ @override_settings(LANGUAGE_CODE="en", LANGUAGES=(("en", "English"),)) class RegistrationTestCase(TestCase): def setUp(self): - # TODO: fix typo in url name in urls.py self.registration_url = reverse("registration_register") self.valid_user_data = { @@ -51,6 +50,7 @@ def test_invalid_email(self): "email": "invalid-address", "password1": "somepassword", "password2": "differentpassword", + "accept_privacy_policy": True, } response = self.client.post(self.registration_url, user_data) @@ -65,7 +65,7 @@ def test_invalid_email(self): assert RegistrationProfile.objects.count() == 0 - def try_invalid_username(self, invalid_username): + def try_invalid_username(self, invalid_username, expected_errors): """ helper method for the next couple of tests checking invalid usernames """ @@ -74,6 +74,7 @@ def try_invalid_username(self, invalid_username): "email": "somename@example.de", "password1": "somepassword", "password2": "somepassword", + "accept_privacy_policy": True, } response = self.client.post(self.registration_url, user_data) @@ -85,20 +86,113 @@ def try_invalid_username(self, invalid_username): response, "form", "username", - "Enter a valid username. This value may contain only letters, numbers, and " - "@/./+/-/_ characters.", + expected_errors, ) assert RegistrationProfile.objects.count() == 0 + def test_username_beginning(self): + self.try_invalid_username("1username", "Username must start with a letter.") + self.try_invalid_username(".username", "Username must start with a letter.") + self.try_invalid_username("_username", "Username must start with a letter.") + + def test_username_ending(self): + self.try_invalid_username( + "username_", "Username must end with a letter or a number." + ) + self.try_invalid_username( + "username.", "Username must end with a letter or a number." + ) + + def test_username_too_short(self): + self.try_invalid_username( + "ab", "Ensure this value has at least 3 characters (it has 2)." + ) + + def test_username_too_long(self): + self.try_invalid_username( + "abcdef_0123456789", + "Ensure this value has at most 16 characters (it has 17).", + ) + + def test_username_with_consequtive_underscores(self): + self.try_invalid_username( + "invalid__name", "Username must not contain consecutive . or _ characters." + ) + + self.try_invalid_username( + "invalid___name", "Username must not contain consecutive . or _ characters." + ) + + def test_username_with_consequtive_dots(self): + self.try_invalid_username( + "invalid..name", "Username must not contain consecutive . or _ characters." + ) + self.try_invalid_username( + "invalid...name", "Username must not contain consecutive . or _ characters." + ) + + def test_username_with_consequtive_funnystuff(self): + self.try_invalid_username( + "invalid._._name", + "Username must not contain consecutive . or _ characters.", + ) + self.try_invalid_username( + "invalid_._name", "Username must not contain consecutive . or _ characters." + ) + def test_username_with_whitespaces(self): - self.try_invalid_username("some invalid name") + self.try_invalid_username( + "user name", + "Invalid username. " + 'Allowed characters are letters, numbers, "." and "_".', + ) + self.try_invalid_username( + " username", + [ + "Username must start with a letter.", + "Invalid username. " + 'Allowed characters are letters, numbers, "." and "_".', + ], + ) + self.try_invalid_username( + "username ", + [ + "Username must end with a letter or a number.", + "Invalid username. " + 'Allowed characters are letters, numbers, "." and "_".', + ], + ) + self.try_invalid_username( + " username ", + [ + "Username must start with a letter.", + "Username must end with a letter or a number.", + "Invalid username. " + 'Allowed characters are letters, numbers, "." and "_".', + ], + ) + self.try_invalid_username( + " user name ", + [ + "Username must start with a letter.", + "Username must end with a letter or a number.", + "Invalid username. " + 'Allowed characters are letters, numbers, "." and "_".', + ], + ) def test_username_with_special_chars(self): - self.try_invalid_username("someinvalidname$") + self.try_invalid_username( + "invalidname$", + 'Invalid username. Allowed characters are letters, numbers, "." and "_".', + ) def test_username_with_umlauts(self): - self.try_invalid_username("somename with ÖÄÜäöüß") + self.try_invalid_username( + "aÖÄÜäöüß", + 'Invalid username. Allowed characters are letters, numbers, "." and "_".', + ) def test_username_exists_already(self): # register first user @@ -118,15 +212,62 @@ def test_username_exists_already(self): assert RegistrationProfile.objects.count() == 1 + def test_privacy_policy_missing(self): + user_data = { + "username": "somename", + "email": "somename@example.de", + "password1": "somepassword", + "password2": "somepassword", + # "accept_privacy_policy": True, + } + + response = self.client.post(self.registration_url, user_data, follow=True) + + form = response.context["form"] + assert ( + form is not None + ), "We expect the form to be displayed again if the submission failed" + + self.assertFormError( + response, "form", "accept_privacy_policy", "This field is required." + ) + + assert RegistrationProfile.objects.count() == 0 + + def test_privacy_policy_not_accepted(self): + user_data = { + "username": "somename", + "email": "somename@example.de", + "password1": "somepassword", + "password2": "somepassword", + "accept_privacy_policy": "false", + } + + response = self.client.post(self.registration_url, user_data, follow=True) + + assert RegistrationProfile.objects.count() == 0 + + form = response.context["form"] + assert ( + form is not None + ), "We expect the form to be displayed again if the submission failed" + + self.assertFormError( + response, "form", "accept_privacy_policy", "This field is required." + ) + def test_passwords_dont_match(self): user_data = { "username": "somename", "email": "somename@example.de", "password1": "somepassword", "password2": "differentpassword", + "accept_privacy_policy": True, } - response = self.client.post(self.registration_url, user_data) + response = self.client.post(self.registration_url, user_data, follow=True) + + assert RegistrationProfile.objects.count() == 0 form = response.context["form"] assert ( @@ -139,8 +280,6 @@ def test_passwords_dont_match(self): response, "form", "password2", "The two password fields didn’t match." ) - assert RegistrationProfile.objects.count() == 0 - def test_submit_valid_form(self): response = self.client.post( self.registration_url, self.valid_user_data, follow=True From cb9fae57aa5c5746436c887f6db16d1cb52c4de4 Mon Sep 17 00:00:00 2001 From: Christoph Meissner Date: Mon, 28 Mar 2022 17:21:09 +0200 Subject: [PATCH 2/6] Fix default empty value for registration form --- templates/registration/registration_form.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/registration/registration_form.html b/templates/registration/registration_form.html index 293b721c..27239380 100644 --- a/templates/registration/registration_form.html +++ b/templates/registration/registration_form.html @@ -24,7 +24,7 @@

{% trans "Create a new account" %}

class="form-control" placeholder="{% trans "Email" %}" name="email" - value="{{ form.cleaned_data.email|default:form.email.value }}"> + value="{{ form.cleaned_data.email|default:form.email.value|default:"" }}">

{% trans "Volunteer-Planner and shelters will send you emails concerning your shifts." %}

@@ -39,7 +39,7 @@

{% trans "Create a new account" %}

id="Username" placeholder="{% trans "Username" %}" name="username" - value="{{ form.cleaned_data.username|default:form.username.value }}"> + value="{{ form.cleaned_data.username|default:form.username.value|default:"" }}">

{% trans "Your username will be visible to other users. Don't use spaces or special characters." %}

From 8bb3c12a747799623049fc7ab81453d39c093e16 Mon Sep 17 00:00:00 2001 From: Christoph Meissner Date: Mon, 28 Mar 2022 17:23:14 +0200 Subject: [PATCH 3/6] Relax username restrictions, * allow umlauts * allow _ at end * simplify regex * add positive tests for allowed usernames --- accounts/forms.py | 32 ++++--------- tests/registration/test_registration.py | 64 ++++++++++++++----------- 2 files changed, 43 insertions(+), 53 deletions(-) diff --git a/accounts/forms.py b/accounts/forms.py index 47de5150..2ee775ab 100644 --- a/accounts/forms.py +++ b/accounts/forms.py @@ -5,32 +5,19 @@ from registration.forms import RegistrationFormUniqueEmail username_first_char_validator = RegexValidator( - r"^[a-zA-Z]", _("Username must start with a letter.") + r"^[_.0-9\s]", _("Username must start with a letter."), + inverse_match=True ) username_validator = RegexValidator( - r"^[a-zA-Z0-9_.]*$", + r"[^\w.]", _('Invalid username. Allowed characters are letters, numbers, "." and "_".'), + inverse_match=True ) username_last_char_validator = RegexValidator( - r"[a-zA-Z0-9]$", _("Username must end with a letter or a number.") + r"[\w]$", _("Username must end with a letter or a number.") ) -no_consequtive_dots = RegexValidator( - r"\.\.", - _("Username must not contain consecutive . or _ characters."), - inverse_match=True, -) -no_consequtive_underscores = RegexValidator( - r"__", - _("Username must not contain consecutive . or _ characters."), - inverse_match=True, -) -no_consequtive_funnystuff = RegexValidator( - r"_\.", - _("Username must not contain consecutive . or _ characters."), - inverse_match=True, -) -no_consequtive_funnystuff2 = RegexValidator( - r"\._", +no_consequtive = RegexValidator( + r"[_.]{2,}", _("Username must not contain consecutive . or _ characters."), inverse_match=True, ) @@ -46,10 +33,7 @@ class RegistrationForm(RegistrationFormUniqueEmail): username_first_char_validator, username_validator, username_last_char_validator, - no_consequtive_dots, - no_consequtive_underscores, - no_consequtive_funnystuff, - no_consequtive_funnystuff2, + no_consequtive, ], ) diff --git a/tests/registration/test_registration.py b/tests/registration/test_registration.py index 11f03df4..6efd4de3 100644 --- a/tests/registration/test_registration.py +++ b/tests/registration/test_registration.py @@ -4,17 +4,44 @@ from django.urls import reverse from registration.models import RegistrationProfile +from accounts.forms import RegistrationForm from accounts.models import UserAccount +@pytest.mark.django_db +@pytest.mark.parametrize( + "username", + [ + "jusernäym", + "üser.name", + "user.name2", + "user.name2_", + "username_2", + "username_2", + "ÄBCDEF0123456789", + ], +) +def test_submit_valid_username(username): + formdata = { + "username": username, + "email": "somename@example.com", + "password1": "somepassword", + "password2": "somepassword", + "accept_privacy_policy": True, + } + form = RegistrationForm(formdata) + assert not form.errors + assert form.is_valid() + + @override_settings(LANGUAGE_CODE="en", LANGUAGES=(("en", "English"),)) class RegistrationTestCase(TestCase): def setUp(self): self.registration_url = reverse("registration_register") self.valid_user_data = { - "username": "somename", - "email": "somename@example.de", + "username": "Some.name123_", + "email": "somename@example.com", "password1": "somepassword", "password2": "somepassword", "accept_privacy_policy": True, @@ -71,7 +98,7 @@ def try_invalid_username(self, invalid_username, expected_errors): """ user_data = { "username": invalid_username, - "email": "somename@example.de", + "email": "somename@example.com", "password1": "somepassword", "password2": "somepassword", "accept_privacy_policy": True, @@ -97,9 +124,6 @@ def test_username_beginning(self): self.try_invalid_username("_username", "Username must start with a letter.") def test_username_ending(self): - self.try_invalid_username( - "username_", "Username must end with a letter or a number." - ) self.try_invalid_username( "username.", "Username must end with a letter or a number." ) @@ -187,10 +211,8 @@ def test_username_with_special_chars(self): "invalidname$", 'Invalid username. Allowed characters are letters, numbers, "." and "_".', ) - - def test_username_with_umlauts(self): self.try_invalid_username( - "aÖÄÜäöüß", + "emoji_😀name", 'Invalid username. Allowed characters are letters, numbers, "." and "_".', ) @@ -215,7 +237,7 @@ def test_username_exists_already(self): def test_privacy_policy_missing(self): user_data = { "username": "somename", - "email": "somename@example.de", + "email": "somename@example.com", "password1": "somepassword", "password2": "somepassword", # "accept_privacy_policy": True, @@ -237,7 +259,7 @@ def test_privacy_policy_missing(self): def test_privacy_policy_not_accepted(self): user_data = { "username": "somename", - "email": "somename@example.de", + "email": "somename@example.com", "password1": "somepassword", "password2": "somepassword", "accept_privacy_policy": "false", @@ -259,7 +281,7 @@ def test_privacy_policy_not_accepted(self): def test_passwords_dont_match(self): user_data = { "username": "somename", - "email": "somename@example.de", + "email": "somename@example.com", "password1": "somepassword", "password2": "differentpassword", "accept_privacy_policy": True, @@ -280,27 +302,11 @@ def test_passwords_dont_match(self): response, "form", "password2", "The two password fields didn’t match." ) - def test_submit_valid_form(self): - response = self.client.post( - self.registration_url, self.valid_user_data, follow=True - ) - - registration_complete_url = reverse("registration_complete") - - self.assertRedirects(response, registration_complete_url) - self.assertContains( - response, "An activation mail will be sent to you email address." - ) - - assert RegistrationProfile.objects.count() == 1 - new_user = RegistrationProfile.objects.first() - assert new_user is not None - assert new_user.user.username == "somename" - def test_registered_user_is_inactive(self): self.client.post(self.registration_url, self.valid_user_data) new_user = RegistrationProfile.objects.first() + assert new_user is not None assert not new_user.user.is_active with pytest.raises(UserAccount.DoesNotExist): From 0df87c2f7a8862ede00d30af4b7eb36fc5137e41 Mon Sep 17 00:00:00 2001 From: Christoph Meissner Date: Mon, 28 Mar 2022 17:30:23 +0200 Subject: [PATCH 4/6] Fix error message for invalid username ending --- accounts/forms.py | 13 ++++++------- locale/ar/LC_MESSAGES/django.po | 8 ++++---- locale/bg/LC_MESSAGES/django.po | 8 ++++---- locale/cs/LC_MESSAGES/django.po | 8 ++++---- locale/da/LC_MESSAGES/django.po | 8 ++++---- locale/de/LC_MESSAGES/django.po | 12 ++++++------ locale/el/LC_MESSAGES/django.po | 8 ++++---- locale/en/LC_MESSAGES/django.po | 8 ++++---- locale/es/LC_MESSAGES/django.po | 8 ++++---- locale/es_MX/LC_MESSAGES/django.po | 8 ++++---- locale/fa/LC_MESSAGES/django.po | 8 ++++---- locale/fr/LC_MESSAGES/django.po | 8 ++++---- locale/hr/LC_MESSAGES/django.po | 8 ++++---- locale/hu/LC_MESSAGES/django.po | 8 ++++---- locale/hy/LC_MESSAGES/django.po | 8 ++++---- locale/it/LC_MESSAGES/django.po | 8 ++++---- locale/nl/LC_MESSAGES/django.po | 8 ++++---- locale/no/LC_MESSAGES/django.po | 8 ++++---- locale/pl/LC_MESSAGES/django.po | 8 ++++---- locale/pt/LC_MESSAGES/django.po | 8 ++++---- locale/pt_BR/LC_MESSAGES/django.po | 8 ++++---- locale/ro/LC_MESSAGES/django.po | 8 ++++---- locale/ru/LC_MESSAGES/django.po | 8 ++++---- locale/sk/LC_MESSAGES/django.po | 8 ++++---- locale/sl/LC_MESSAGES/django.po | 8 ++++---- locale/sq/LC_MESSAGES/django.po | 8 ++++---- locale/sr_RS/LC_MESSAGES/django.po | 8 ++++---- locale/sv/LC_MESSAGES/django.po | 8 ++++---- locale/tr/LC_MESSAGES/django.po | 8 ++++---- locale/tr_TR/LC_MESSAGES/django.po | 8 ++++---- locale/uk/LC_MESSAGES/django.po | 8 ++++---- locale/zh_CN/LC_MESSAGES/django.po | 8 ++++---- 32 files changed, 132 insertions(+), 133 deletions(-) diff --git a/accounts/forms.py b/accounts/forms.py index 2ee775ab..04c5e9d2 100644 --- a/accounts/forms.py +++ b/accounts/forms.py @@ -4,17 +4,16 @@ from registration.forms import RegistrationFormUniqueEmail -username_first_char_validator = RegexValidator( - r"^[_.0-9\s]", _("Username must start with a letter."), - inverse_match=True -) username_validator = RegexValidator( r"[^\w.]", _('Invalid username. Allowed characters are letters, numbers, "." and "_".'), - inverse_match=True + inverse_match=True, +) +username_first_char_validator = RegexValidator( + r"^[_.0-9\s]", _("Username must start with a letter."), inverse_match=True ) username_last_char_validator = RegexValidator( - r"[\w]$", _("Username must end with a letter or a number.") + r"[\w]$", _('Username must end with a letter, a number or "_".') ) no_consequtive = RegexValidator( r"[_.]{2,}", @@ -30,8 +29,8 @@ class RegistrationForm(RegistrationFormUniqueEmail): min_length=3, strip=False, validators=[ - username_first_char_validator, username_validator, + username_first_char_validator, username_last_char_validator, no_consequtive, ], diff --git a/locale/ar/LC_MESSAGES/django.po b/locale/ar/LC_MESSAGES/django.po index a141a40e..7c6ede8c 100644 --- a/locale/ar/LC_MESSAGES/django.po +++ b/locale/ar/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-25 21:54+0100\n" +"POT-Creation-Date: 2022-03-28 17:29+0200\n" "PO-Revision-Date: 2022-03-15 17:56+0000\n" "Last-Translator: Christoph Meißner\n" "Language-Team: Arabic (http://www.transifex.com/coders4help/volunteer-planner/language/ar/)\n" @@ -36,13 +36,13 @@ msgstr "" msgid "Accounts" msgstr "الحسابات " -msgid "Username must start with a letter." +msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." msgstr "" -msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." +msgid "Username must start with a letter." msgstr "" -msgid "Username must end with a letter or a number." +msgid "Username must end with a letter, a number or \"_\"." msgstr "" msgid "Username must not contain consecutive . or _ characters." diff --git a/locale/bg/LC_MESSAGES/django.po b/locale/bg/LC_MESSAGES/django.po index 766467e5..99deafed 100644 --- a/locale/bg/LC_MESSAGES/django.po +++ b/locale/bg/LC_MESSAGES/django.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-25 21:54+0100\n" +"POT-Creation-Date: 2022-03-28 17:29+0200\n" "PO-Revision-Date: 2022-03-15 17:56+0000\n" "Last-Translator: Christoph Meißner\n" "Language-Team: Bulgarian (http://www.transifex.com/coders4help/volunteer-planner/language/bg/)\n" @@ -32,13 +32,13 @@ msgstr "" msgid "Accounts" msgstr "" -msgid "Username must start with a letter." +msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." msgstr "" -msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." +msgid "Username must start with a letter." msgstr "" -msgid "Username must end with a letter or a number." +msgid "Username must end with a letter, a number or \"_\"." msgstr "" msgid "Username must not contain consecutive . or _ characters." diff --git a/locale/cs/LC_MESSAGES/django.po b/locale/cs/LC_MESSAGES/django.po index a2c4814b..98966626 100644 --- a/locale/cs/LC_MESSAGES/django.po +++ b/locale/cs/LC_MESSAGES/django.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-25 21:54+0100\n" +"POT-Creation-Date: 2022-03-28 17:29+0200\n" "PO-Revision-Date: 2022-03-15 17:56+0000\n" "Last-Translator: Christoph Meißner\n" "Language-Team: Czech (http://www.transifex.com/coders4help/volunteer-planner/language/cs/)\n" @@ -34,13 +34,13 @@ msgstr "poslední přihlášení" msgid "Accounts" msgstr "Účty" -msgid "Username must start with a letter." +msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." msgstr "" -msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." +msgid "Username must start with a letter." msgstr "" -msgid "Username must end with a letter or a number." +msgid "Username must end with a letter, a number or \"_\"." msgstr "" msgid "Username must not contain consecutive . or _ characters." diff --git a/locale/da/LC_MESSAGES/django.po b/locale/da/LC_MESSAGES/django.po index e767a6ad..b2cc5083 100644 --- a/locale/da/LC_MESSAGES/django.po +++ b/locale/da/LC_MESSAGES/django.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-25 21:54+0100\n" +"POT-Creation-Date: 2022-03-28 17:29+0200\n" "PO-Revision-Date: 2017-09-22 15:35+0000\n" "Last-Translator: Dorian Cantzen \n" "Language-Team: Danish (http://www.transifex.com/coders4help/volunteer-planner/language/da/)\n" @@ -33,13 +33,13 @@ msgstr "" msgid "Accounts" msgstr "" -msgid "Username must start with a letter." +msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." msgstr "" -msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." +msgid "Username must start with a letter." msgstr "" -msgid "Username must end with a letter or a number." +msgid "Username must end with a letter, a number or \"_\"." msgstr "" msgid "Username must not contain consecutive . or _ characters." diff --git a/locale/de/LC_MESSAGES/django.po b/locale/de/LC_MESSAGES/django.po index 135a4116..0ee40993 100644 --- a/locale/de/LC_MESSAGES/django.po +++ b/locale/de/LC_MESSAGES/django.po @@ -19,7 +19,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-25 21:54+0100\n" +"POT-Creation-Date: 2022-03-28 17:29+0200\n" "PO-Revision-Date: 2016-11-21 18:24+0000\n" "Last-Translator: Sönke Klinger \n" "Language-Team: German (http://www.transifex.com/coders4help/volunteer-planner/language/de/)\n" @@ -47,14 +47,14 @@ msgstr "Letzte Anmeldung" msgid "Accounts" msgstr "Benutzerkonten" -msgid "Username must start with a letter." -msgstr "Benutzername muss mit einem Buchstaben anfangen." - msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." msgstr "Ungültiger Benutzername. Erlaubte Zeichen sind Buchstaben, Ziffern, \".\" and \".\"." -msgid "Username must end with a letter or a number." -msgstr "Benutzername muss mit einem Buchstaben oder einer Ziffer enden." +msgid "Username must start with a letter." +msgstr "Benutzername muss mit einem Buchstaben anfangen." + +msgid "Username must end with a letter, a number or \"_\"." +msgstr "Benutzername muss mit einem Buchstaben, einer Ziffer oder \"_\" enden." msgid "Username must not contain consecutive . or _ characters." msgstr "Benutzername darf keine aufeinanderfolgenden . oder _ enthalten." diff --git a/locale/el/LC_MESSAGES/django.po b/locale/el/LC_MESSAGES/django.po index 640ad598..472c55cf 100644 --- a/locale/el/LC_MESSAGES/django.po +++ b/locale/el/LC_MESSAGES/django.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-25 21:54+0100\n" +"POT-Creation-Date: 2022-03-28 17:29+0200\n" "PO-Revision-Date: 2016-01-29 08:23+0000\n" "Last-Translator: Dorian Cantzen \n" "Language-Team: Greek (http://www.transifex.com/coders4help/volunteer-planner/language/el/)\n" @@ -37,13 +37,13 @@ msgstr "" msgid "Accounts" msgstr "Λογαριασμοί" -msgid "Username must start with a letter." +msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." msgstr "" -msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." +msgid "Username must start with a letter." msgstr "" -msgid "Username must end with a letter or a number." +msgid "Username must end with a letter, a number or \"_\"." msgstr "" msgid "Username must not contain consecutive . or _ characters." diff --git a/locale/en/LC_MESSAGES/django.po b/locale/en/LC_MESSAGES/django.po index bcc9d0c5..846b8b11 100644 --- a/locale/en/LC_MESSAGES/django.po +++ b/locale/en/LC_MESSAGES/django.po @@ -2,7 +2,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-25 21:54+0100\n" +"POT-Creation-Date: 2022-03-28 17:29+0200\n" "PO-Revision-Date: 2015-10-04 21:53+0000\n" "Last-Translator: Dorian Cantzen \n" "Language-Team: English (http://www.transifex.com/coders4help/volunteer-planner/language/en/)\n" @@ -29,13 +29,13 @@ msgstr "" msgid "Accounts" msgstr "" -msgid "Username must start with a letter." +msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." msgstr "" -msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." +msgid "Username must start with a letter." msgstr "" -msgid "Username must end with a letter or a number." +msgid "Username must end with a letter, a number or \"_\"." msgstr "" msgid "Username must not contain consecutive . or _ characters." diff --git a/locale/es/LC_MESSAGES/django.po b/locale/es/LC_MESSAGES/django.po index ff5d2e6b..66974347 100644 --- a/locale/es/LC_MESSAGES/django.po +++ b/locale/es/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-25 21:54+0100\n" +"POT-Creation-Date: 2022-03-28 17:29+0200\n" "PO-Revision-Date: 2016-04-13 17:27+0000\n" "Last-Translator: Antonio Mireles \n" "Language-Team: Spanish (http://www.transifex.com/coders4help/volunteer-planner/language/es/)\n" @@ -36,13 +36,13 @@ msgstr "" msgid "Accounts" msgstr "Cuentas" -msgid "Username must start with a letter." +msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." msgstr "" -msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." +msgid "Username must start with a letter." msgstr "" -msgid "Username must end with a letter or a number." +msgid "Username must end with a letter, a number or \"_\"." msgstr "" msgid "Username must not contain consecutive . or _ characters." diff --git a/locale/es_MX/LC_MESSAGES/django.po b/locale/es_MX/LC_MESSAGES/django.po index fe78cd39..0345a70b 100644 --- a/locale/es_MX/LC_MESSAGES/django.po +++ b/locale/es_MX/LC_MESSAGES/django.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-25 21:54+0100\n" +"POT-Creation-Date: 2022-03-28 17:29+0200\n" "PO-Revision-Date: 2015-09-24 12:23+0000\n" "Last-Translator: Dorian Cantzen \n" "Language-Team: Spanish (Mexico) (http://www.transifex.com/coders4help/volunteer-planner/language/es_MX/)\n" @@ -32,13 +32,13 @@ msgstr "" msgid "Accounts" msgstr "" -msgid "Username must start with a letter." +msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." msgstr "" -msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." +msgid "Username must start with a letter." msgstr "" -msgid "Username must end with a letter or a number." +msgid "Username must end with a letter, a number or \"_\"." msgstr "" msgid "Username must not contain consecutive . or _ characters." diff --git a/locale/fa/LC_MESSAGES/django.po b/locale/fa/LC_MESSAGES/django.po index 77ddf0d9..f36044d7 100644 --- a/locale/fa/LC_MESSAGES/django.po +++ b/locale/fa/LC_MESSAGES/django.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-25 21:54+0100\n" +"POT-Creation-Date: 2022-03-28 17:29+0200\n" "PO-Revision-Date: 2016-01-29 08:23+0000\n" "Last-Translator: Dorian Cantzen \n" "Language-Team: Persian (http://www.transifex.com/coders4help/volunteer-planner/language/fa/)\n" @@ -32,13 +32,13 @@ msgstr "" msgid "Accounts" msgstr "" -msgid "Username must start with a letter." +msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." msgstr "" -msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." +msgid "Username must start with a letter." msgstr "" -msgid "Username must end with a letter or a number." +msgid "Username must end with a letter, a number or \"_\"." msgstr "" msgid "Username must not contain consecutive . or _ characters." diff --git a/locale/fr/LC_MESSAGES/django.po b/locale/fr/LC_MESSAGES/django.po index 2cbea4e7..ea64dc0d 100644 --- a/locale/fr/LC_MESSAGES/django.po +++ b/locale/fr/LC_MESSAGES/django.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-25 21:54+0100\n" +"POT-Creation-Date: 2022-03-28 17:29+0200\n" "PO-Revision-Date: 2016-12-08 20:50+0000\n" "Last-Translator: Dolfeus \n" "Language-Team: French (http://www.transifex.com/coders4help/volunteer-planner/language/fr/)\n" @@ -38,13 +38,13 @@ msgstr "" msgid "Accounts" msgstr "Comptes utilisateur" -msgid "Username must start with a letter." +msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." msgstr "" -msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." +msgid "Username must start with a letter." msgstr "" -msgid "Username must end with a letter or a number." +msgid "Username must end with a letter, a number or \"_\"." msgstr "" msgid "Username must not contain consecutive . or _ characters." diff --git a/locale/hr/LC_MESSAGES/django.po b/locale/hr/LC_MESSAGES/django.po index 37009e2b..16a8f2f3 100644 --- a/locale/hr/LC_MESSAGES/django.po +++ b/locale/hr/LC_MESSAGES/django.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-25 21:54+0100\n" +"POT-Creation-Date: 2022-03-28 17:29+0200\n" "PO-Revision-Date: 2016-01-29 08:23+0000\n" "Last-Translator: Dorian Cantzen \n" "Language-Team: Croatian (http://www.transifex.com/coders4help/volunteer-planner/language/hr/)\n" @@ -32,13 +32,13 @@ msgstr "" msgid "Accounts" msgstr "" -msgid "Username must start with a letter." +msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." msgstr "" -msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." +msgid "Username must start with a letter." msgstr "" -msgid "Username must end with a letter or a number." +msgid "Username must end with a letter, a number or \"_\"." msgstr "" msgid "Username must not contain consecutive . or _ characters." diff --git a/locale/hu/LC_MESSAGES/django.po b/locale/hu/LC_MESSAGES/django.po index c79e58ac..b9ac83d0 100644 --- a/locale/hu/LC_MESSAGES/django.po +++ b/locale/hu/LC_MESSAGES/django.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-25 21:54+0100\n" +"POT-Creation-Date: 2022-03-28 17:29+0200\n" "PO-Revision-Date: 2016-01-29 08:23+0000\n" "Last-Translator: Dorian Cantzen \n" "Language-Team: Hungarian (http://www.transifex.com/coders4help/volunteer-planner/language/hu/)\n" @@ -42,13 +42,13 @@ msgstr "" msgid "Accounts" msgstr "" -msgid "Username must start with a letter." +msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." msgstr "" -msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." +msgid "Username must start with a letter." msgstr "" -msgid "Username must end with a letter or a number." +msgid "Username must end with a letter, a number or \"_\"." msgstr "" msgid "Username must not contain consecutive . or _ characters." diff --git a/locale/hy/LC_MESSAGES/django.po b/locale/hy/LC_MESSAGES/django.po index c79349f3..7aae2eea 100644 --- a/locale/hy/LC_MESSAGES/django.po +++ b/locale/hy/LC_MESSAGES/django.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-25 21:54+0100\n" +"POT-Creation-Date: 2022-03-28 17:29+0200\n" "PO-Revision-Date: 2015-09-24 12:23+0000\n" "Last-Translator: Dorian Cantzen \n" "Language-Team: Armenian (http://www.transifex.com/coders4help/volunteer-planner/language/hy/)\n" @@ -32,13 +32,13 @@ msgstr "" msgid "Accounts" msgstr "" -msgid "Username must start with a letter." +msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." msgstr "" -msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." +msgid "Username must start with a letter." msgstr "" -msgid "Username must end with a letter or a number." +msgid "Username must end with a letter, a number or \"_\"." msgstr "" msgid "Username must not contain consecutive . or _ characters." diff --git a/locale/it/LC_MESSAGES/django.po b/locale/it/LC_MESSAGES/django.po index 08efeb03..0fbe0914 100644 --- a/locale/it/LC_MESSAGES/django.po +++ b/locale/it/LC_MESSAGES/django.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-25 21:54+0100\n" +"POT-Creation-Date: 2022-03-28 17:29+0200\n" "PO-Revision-Date: 2016-01-29 08:23+0000\n" "Last-Translator: Dorian Cantzen \n" "Language-Team: Italian (http://www.transifex.com/coders4help/volunteer-planner/language/it/)\n" @@ -32,13 +32,13 @@ msgstr "" msgid "Accounts" msgstr "" -msgid "Username must start with a letter." +msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." msgstr "" -msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." +msgid "Username must start with a letter." msgstr "" -msgid "Username must end with a letter or a number." +msgid "Username must end with a letter, a number or \"_\"." msgstr "" msgid "Username must not contain consecutive . or _ characters." diff --git a/locale/nl/LC_MESSAGES/django.po b/locale/nl/LC_MESSAGES/django.po index 4a110c3e..81515313 100644 --- a/locale/nl/LC_MESSAGES/django.po +++ b/locale/nl/LC_MESSAGES/django.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-25 21:54+0100\n" +"POT-Creation-Date: 2022-03-28 17:29+0200\n" "PO-Revision-Date: 2016-01-29 08:23+0000\n" "Last-Translator: Dorian Cantzen \n" "Language-Team: Dutch (http://www.transifex.com/coders4help/volunteer-planner/language/nl/)\n" @@ -32,13 +32,13 @@ msgstr "" msgid "Accounts" msgstr "" -msgid "Username must start with a letter." +msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." msgstr "" -msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." +msgid "Username must start with a letter." msgstr "" -msgid "Username must end with a letter or a number." +msgid "Username must end with a letter, a number or \"_\"." msgstr "" msgid "Username must not contain consecutive . or _ characters." diff --git a/locale/no/LC_MESSAGES/django.po b/locale/no/LC_MESSAGES/django.po index 7bacae08..5edcfbe5 100644 --- a/locale/no/LC_MESSAGES/django.po +++ b/locale/no/LC_MESSAGES/django.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-25 21:54+0100\n" +"POT-Creation-Date: 2022-03-28 17:29+0200\n" "PO-Revision-Date: 2016-01-29 08:23+0000\n" "Last-Translator: Dorian Cantzen \n" "Language-Team: Norwegian (http://www.transifex.com/coders4help/volunteer-planner/language/no/)\n" @@ -32,13 +32,13 @@ msgstr "" msgid "Accounts" msgstr "" -msgid "Username must start with a letter." +msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." msgstr "" -msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." +msgid "Username must start with a letter." msgstr "" -msgid "Username must end with a letter or a number." +msgid "Username must end with a letter, a number or \"_\"." msgstr "" msgid "Username must not contain consecutive . or _ characters." diff --git a/locale/pl/LC_MESSAGES/django.po b/locale/pl/LC_MESSAGES/django.po index 5735d151..7da1c679 100644 --- a/locale/pl/LC_MESSAGES/django.po +++ b/locale/pl/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-25 21:54+0100\n" +"POT-Creation-Date: 2022-03-28 17:29+0200\n" "PO-Revision-Date: 2017-09-22 15:29+0000\n" "Last-Translator: Dorian Cantzen \n" "Language-Team: Polish (http://www.transifex.com/coders4help/volunteer-planner/language/pl/)\n" @@ -36,13 +36,13 @@ msgstr "" msgid "Accounts" msgstr "" -msgid "Username must start with a letter." +msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." msgstr "" -msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." +msgid "Username must start with a letter." msgstr "" -msgid "Username must end with a letter or a number." +msgid "Username must end with a letter, a number or \"_\"." msgstr "" msgid "Username must not contain consecutive . or _ characters." diff --git a/locale/pt/LC_MESSAGES/django.po b/locale/pt/LC_MESSAGES/django.po index 265bdf6d..6d61b79a 100644 --- a/locale/pt/LC_MESSAGES/django.po +++ b/locale/pt/LC_MESSAGES/django.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-25 21:54+0100\n" +"POT-Creation-Date: 2022-03-28 17:29+0200\n" "PO-Revision-Date: 2016-01-29 08:23+0000\n" "Last-Translator: Dorian Cantzen \n" "Language-Team: Portuguese (http://www.transifex.com/coders4help/volunteer-planner/language/pt/)\n" @@ -37,13 +37,13 @@ msgstr "" msgid "Accounts" msgstr "Contas" -msgid "Username must start with a letter." +msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." msgstr "" -msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." +msgid "Username must start with a letter." msgstr "" -msgid "Username must end with a letter or a number." +msgid "Username must end with a letter, a number or \"_\"." msgstr "" msgid "Username must not contain consecutive . or _ characters." diff --git a/locale/pt_BR/LC_MESSAGES/django.po b/locale/pt_BR/LC_MESSAGES/django.po index 1a16d097..8d87dfcb 100644 --- a/locale/pt_BR/LC_MESSAGES/django.po +++ b/locale/pt_BR/LC_MESSAGES/django.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-25 21:54+0100\n" +"POT-Creation-Date: 2022-03-28 17:29+0200\n" "PO-Revision-Date: 2015-09-24 12:23+0000\n" "Last-Translator: Dorian Cantzen \n" "Language-Team: Portuguese (Brazil) (http://www.transifex.com/coders4help/volunteer-planner/language/pt_BR/)\n" @@ -32,13 +32,13 @@ msgstr "" msgid "Accounts" msgstr "" -msgid "Username must start with a letter." +msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." msgstr "" -msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." +msgid "Username must start with a letter." msgstr "" -msgid "Username must end with a letter or a number." +msgid "Username must end with a letter, a number or \"_\"." msgstr "" msgid "Username must not contain consecutive . or _ characters." diff --git a/locale/ro/LC_MESSAGES/django.po b/locale/ro/LC_MESSAGES/django.po index d4fc15db..f88d608d 100644 --- a/locale/ro/LC_MESSAGES/django.po +++ b/locale/ro/LC_MESSAGES/django.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-25 21:54+0100\n" +"POT-Creation-Date: 2022-03-28 17:29+0200\n" "PO-Revision-Date: 2016-01-29 08:23+0000\n" "Last-Translator: Dorian Cantzen \n" "Language-Team: Romanian (http://www.transifex.com/coders4help/volunteer-planner/language/ro/)\n" @@ -32,13 +32,13 @@ msgstr "" msgid "Accounts" msgstr "" -msgid "Username must start with a letter." +msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." msgstr "" -msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." +msgid "Username must start with a letter." msgstr "" -msgid "Username must end with a letter or a number." +msgid "Username must end with a letter, a number or \"_\"." msgstr "" msgid "Username must not contain consecutive . or _ characters." diff --git a/locale/ru/LC_MESSAGES/django.po b/locale/ru/LC_MESSAGES/django.po index ef35bc32..53d27cbd 100644 --- a/locale/ru/LC_MESSAGES/django.po +++ b/locale/ru/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-25 21:54+0100\n" +"POT-Creation-Date: 2022-03-28 17:29+0200\n" "PO-Revision-Date: 2022-03-10 13:42+0000\n" "Last-Translator: Anna Dunn\n" "Language-Team: Russian (http://www.transifex.com/coders4help/volunteer-planner/language/ru/)\n" @@ -36,13 +36,13 @@ msgstr "" msgid "Accounts" msgstr "Aккаунты" -msgid "Username must start with a letter." +msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." msgstr "" -msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." +msgid "Username must start with a letter." msgstr "" -msgid "Username must end with a letter or a number." +msgid "Username must end with a letter, a number or \"_\"." msgstr "" msgid "Username must not contain consecutive . or _ characters." diff --git a/locale/sk/LC_MESSAGES/django.po b/locale/sk/LC_MESSAGES/django.po index 9d0731b0..e8bed54d 100644 --- a/locale/sk/LC_MESSAGES/django.po +++ b/locale/sk/LC_MESSAGES/django.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-25 21:54+0100\n" +"POT-Creation-Date: 2022-03-28 17:29+0200\n" "PO-Revision-Date: 2016-01-29 08:23+0000\n" "Last-Translator: Dorian Cantzen \n" "Language-Team: Slovak (http://www.transifex.com/coders4help/volunteer-planner/language/sk/)\n" @@ -32,13 +32,13 @@ msgstr "" msgid "Accounts" msgstr "" -msgid "Username must start with a letter." +msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." msgstr "" -msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." +msgid "Username must start with a letter." msgstr "" -msgid "Username must end with a letter or a number." +msgid "Username must end with a letter, a number or \"_\"." msgstr "" msgid "Username must not contain consecutive . or _ characters." diff --git a/locale/sl/LC_MESSAGES/django.po b/locale/sl/LC_MESSAGES/django.po index 2c2773c4..02320e36 100644 --- a/locale/sl/LC_MESSAGES/django.po +++ b/locale/sl/LC_MESSAGES/django.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-25 21:54+0100\n" +"POT-Creation-Date: 2022-03-28 17:29+0200\n" "PO-Revision-Date: 2016-01-29 08:23+0000\n" "Last-Translator: Dorian Cantzen \n" "Language-Team: Slovenian (http://www.transifex.com/coders4help/volunteer-planner/language/sl/)\n" @@ -32,13 +32,13 @@ msgstr "" msgid "Accounts" msgstr "" -msgid "Username must start with a letter." +msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." msgstr "" -msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." +msgid "Username must start with a letter." msgstr "" -msgid "Username must end with a letter or a number." +msgid "Username must end with a letter, a number or \"_\"." msgstr "" msgid "Username must not contain consecutive . or _ characters." diff --git a/locale/sq/LC_MESSAGES/django.po b/locale/sq/LC_MESSAGES/django.po index e25b8429..0c5a497b 100644 --- a/locale/sq/LC_MESSAGES/django.po +++ b/locale/sq/LC_MESSAGES/django.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-25 21:54+0100\n" +"POT-Creation-Date: 2022-03-28 17:29+0200\n" "PO-Revision-Date: 2016-01-29 08:23+0000\n" "Last-Translator: Dorian Cantzen \n" "Language-Team: Albanian (http://www.transifex.com/coders4help/volunteer-planner/language/sq/)\n" @@ -32,13 +32,13 @@ msgstr "" msgid "Accounts" msgstr "" -msgid "Username must start with a letter." +msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." msgstr "" -msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." +msgid "Username must start with a letter." msgstr "" -msgid "Username must end with a letter or a number." +msgid "Username must end with a letter, a number or \"_\"." msgstr "" msgid "Username must not contain consecutive . or _ characters." diff --git a/locale/sr_RS/LC_MESSAGES/django.po b/locale/sr_RS/LC_MESSAGES/django.po index 7f1de3ab..e1f2c5fd 100644 --- a/locale/sr_RS/LC_MESSAGES/django.po +++ b/locale/sr_RS/LC_MESSAGES/django.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-25 21:54+0100\n" +"POT-Creation-Date: 2022-03-28 17:29+0200\n" "PO-Revision-Date: 2016-01-29 08:23+0000\n" "Last-Translator: Dorian Cantzen \n" "Language-Team: Serbian (Serbia) (http://www.transifex.com/coders4help/volunteer-planner/language/sr_RS/)\n" @@ -32,13 +32,13 @@ msgstr "" msgid "Accounts" msgstr "" -msgid "Username must start with a letter." +msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." msgstr "" -msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." +msgid "Username must start with a letter." msgstr "" -msgid "Username must end with a letter or a number." +msgid "Username must end with a letter, a number or \"_\"." msgstr "" msgid "Username must not contain consecutive . or _ characters." diff --git a/locale/sv/LC_MESSAGES/django.po b/locale/sv/LC_MESSAGES/django.po index 97ac24ad..6b00af72 100644 --- a/locale/sv/LC_MESSAGES/django.po +++ b/locale/sv/LC_MESSAGES/django.po @@ -11,7 +11,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-25 21:54+0100\n" +"POT-Creation-Date: 2022-03-28 17:29+0200\n" "PO-Revision-Date: 2016-01-29 08:23+0000\n" "Last-Translator: Dorian Cantzen \n" "Language-Team: Swedish (http://www.transifex.com/coders4help/volunteer-planner/language/sv/)\n" @@ -39,13 +39,13 @@ msgstr "" msgid "Accounts" msgstr "Konton" -msgid "Username must start with a letter." +msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." msgstr "" -msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." +msgid "Username must start with a letter." msgstr "" -msgid "Username must end with a letter or a number." +msgid "Username must end with a letter, a number or \"_\"." msgstr "" msgid "Username must not contain consecutive . or _ characters." diff --git a/locale/tr/LC_MESSAGES/django.po b/locale/tr/LC_MESSAGES/django.po index c33fb0f1..16632b56 100644 --- a/locale/tr/LC_MESSAGES/django.po +++ b/locale/tr/LC_MESSAGES/django.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-25 21:54+0100\n" +"POT-Creation-Date: 2022-03-28 17:29+0200\n" "PO-Revision-Date: 2016-01-29 08:23+0000\n" "Last-Translator: Dorian Cantzen \n" "Language-Team: Turkish (http://www.transifex.com/coders4help/volunteer-planner/language/tr/)\n" @@ -33,13 +33,13 @@ msgstr "" msgid "Accounts" msgstr "" -msgid "Username must start with a letter." +msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." msgstr "" -msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." +msgid "Username must start with a letter." msgstr "" -msgid "Username must end with a letter or a number." +msgid "Username must end with a letter, a number or \"_\"." msgstr "" msgid "Username must not contain consecutive . or _ characters." diff --git a/locale/tr_TR/LC_MESSAGES/django.po b/locale/tr_TR/LC_MESSAGES/django.po index a189373f..acda3e93 100644 --- a/locale/tr_TR/LC_MESSAGES/django.po +++ b/locale/tr_TR/LC_MESSAGES/django.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-25 21:54+0100\n" +"POT-Creation-Date: 2022-03-28 17:29+0200\n" "PO-Revision-Date: 2015-09-24 12:23+0000\n" "Last-Translator: Dorian Cantzen \n" "Language-Team: Turkish (Turkey) (http://www.transifex.com/coders4help/volunteer-planner/language/tr_TR/)\n" @@ -32,13 +32,13 @@ msgstr "" msgid "Accounts" msgstr "" -msgid "Username must start with a letter." +msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." msgstr "" -msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." +msgid "Username must start with a letter." msgstr "" -msgid "Username must end with a letter or a number." +msgid "Username must end with a letter, a number or \"_\"." msgstr "" msgid "Username must not contain consecutive . or _ characters." diff --git a/locale/uk/LC_MESSAGES/django.po b/locale/uk/LC_MESSAGES/django.po index 9f9ad1a8..20f10bcd 100644 --- a/locale/uk/LC_MESSAGES/django.po +++ b/locale/uk/LC_MESSAGES/django.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-25 21:54+0100\n" +"POT-Creation-Date: 2022-03-28 17:29+0200\n" "PO-Revision-Date: 2015-09-24 12:23+0000\n" "Last-Translator: Dorian Cantzen \n" "Language-Team: Ukrainian (http://www.transifex.com/coders4help/volunteer-planner/language/uk/)\n" @@ -32,13 +32,13 @@ msgstr "" msgid "Accounts" msgstr "" -msgid "Username must start with a letter." +msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." msgstr "" -msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." +msgid "Username must start with a letter." msgstr "" -msgid "Username must end with a letter or a number." +msgid "Username must end with a letter, a number or \"_\"." msgstr "" msgid "Username must not contain consecutive . or _ characters." diff --git a/locale/zh_CN/LC_MESSAGES/django.po b/locale/zh_CN/LC_MESSAGES/django.po index 7043b7a1..0a36f0fc 100644 --- a/locale/zh_CN/LC_MESSAGES/django.po +++ b/locale/zh_CN/LC_MESSAGES/django.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-25 21:54+0100\n" +"POT-Creation-Date: 2022-03-28 17:29+0200\n" "PO-Revision-Date: 2015-09-24 12:23+0000\n" "Last-Translator: Dorian Cantzen \n" "Language-Team: Chinese (China) (http://www.transifex.com/coders4help/volunteer-planner/language/zh_CN/)\n" @@ -32,13 +32,13 @@ msgstr "" msgid "Accounts" msgstr "" -msgid "Username must start with a letter." +msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." msgstr "" -msgid "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." +msgid "Username must start with a letter." msgstr "" -msgid "Username must end with a letter or a number." +msgid "Username must end with a letter, a number or \"_\"." msgstr "" msgid "Username must not contain consecutive . or _ characters." From 7d8c69b0ad41c4ab86baa57cba1a95e597335892 Mon Sep 17 00:00:00 2001 From: Christoph Meissner Date: Mon, 28 Mar 2022 17:35:40 +0200 Subject: [PATCH 5/6] Fix tests for username ending Error message was changed but the expected error text in the test was not changed --- tests/registration/test_registration.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/registration/test_registration.py b/tests/registration/test_registration.py index 6efd4de3..5b6abd03 100644 --- a/tests/registration/test_registration.py +++ b/tests/registration/test_registration.py @@ -125,7 +125,7 @@ def test_username_beginning(self): def test_username_ending(self): self.try_invalid_username( - "username.", "Username must end with a letter or a number." + "username.", 'Username must end with a letter, a number or "_".' ) def test_username_too_short(self): @@ -182,7 +182,7 @@ def test_username_with_whitespaces(self): self.try_invalid_username( "username ", [ - "Username must end with a letter or a number.", + 'Username must end with a letter, a number or "_".', "Invalid username. " 'Allowed characters are letters, numbers, "." and "_".', ], @@ -191,7 +191,7 @@ def test_username_with_whitespaces(self): " username ", [ "Username must start with a letter.", - "Username must end with a letter or a number.", + 'Username must end with a letter, a number or "_".', "Invalid username. " 'Allowed characters are letters, numbers, "." and "_".', ], @@ -200,7 +200,7 @@ def test_username_with_whitespaces(self): " user name ", [ "Username must start with a letter.", - "Username must end with a letter or a number.", + 'Username must end with a letter, a number or "_".', "Invalid username. " 'Allowed characters are letters, numbers, "." and "_".', ], From 6534257a5db1e6ee43b5c4b5cb8b59ba305d6f9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Mei=C3=9Fner?= Date: Tue, 29 Mar 2022 10:56:25 +0200 Subject: [PATCH 6/6] Apply suggestions from review Co-authored-by: pitpalme --- accounts/forms.py | 4 ++-- tests/registration/test_registration.py | 7 ++----- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/accounts/forms.py b/accounts/forms.py index 04c5e9d2..0f0758a5 100644 --- a/accounts/forms.py +++ b/accounts/forms.py @@ -10,7 +10,7 @@ inverse_match=True, ) username_first_char_validator = RegexValidator( - r"^[_.0-9\s]", _("Username must start with a letter."), inverse_match=True + r"^[\d_.]", _("Username must start with a letter."), inverse_match=True ) username_last_char_validator = RegexValidator( r"[\w]$", _('Username must end with a letter, a number or "_".') @@ -25,7 +25,7 @@ class RegistrationForm(RegistrationFormUniqueEmail): username = forms.CharField( - max_length=16, + max_length=32, min_length=3, strip=False, validators=[ diff --git a/tests/registration/test_registration.py b/tests/registration/test_registration.py index 5b6abd03..147c1075 100644 --- a/tests/registration/test_registration.py +++ b/tests/registration/test_registration.py @@ -135,8 +135,8 @@ def test_username_too_short(self): def test_username_too_long(self): self.try_invalid_username( - "abcdef_0123456789", - "Ensure this value has at most 16 characters (it has 17).", + "abcdef0123456789.abcdef0123456789", + "Ensure this value has at most 32 characters (it has 33).", ) def test_username_with_consequtive_underscores(self): @@ -174,7 +174,6 @@ def test_username_with_whitespaces(self): self.try_invalid_username( " username", [ - "Username must start with a letter.", "Invalid username. " 'Allowed characters are letters, numbers, "." and "_".', ], @@ -190,7 +189,6 @@ def test_username_with_whitespaces(self): self.try_invalid_username( " username ", [ - "Username must start with a letter.", 'Username must end with a letter, a number or "_".', "Invalid username. " 'Allowed characters are letters, numbers, "." and "_".', @@ -199,7 +197,6 @@ def test_username_with_whitespaces(self): self.try_invalid_username( " user name ", [ - "Username must start with a letter.", 'Username must end with a letter, a number or "_".', "Invalid username. " 'Allowed characters are letters, numbers, "." and "_".',