-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
1 parent
31d25ca
commit dbc4919
Showing
34 changed files
with
603 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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") | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 <[email protected]>\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 "" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 <[email protected]>\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)" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 <[email protected]>\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 "" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 <[email protected]>\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 "" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 <[email protected]>\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 "" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 <[email protected]>\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 "" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 <[email protected]>\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 "" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 <[email protected]>\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 "" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 <[email protected]>\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 "" | ||
|
||
|
Oops, something went wrong.