-
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.
Merge pull request #520 from christophmeissner/feature/494-restrict-u…
…sernames Restrict new usernames
- Loading branch information
Showing
34 changed files
with
610 additions
and
64 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,41 @@ | ||
from django import forms | ||
from django.core.validators import RegexValidator | ||
from django.utils.text import gettext_lazy as _ | ||
|
||
from registration.forms import RegistrationFormUniqueEmail | ||
|
||
username_validator = RegexValidator( | ||
r"[^\w.]", | ||
_('Invalid username. Allowed characters are letters, numbers, "." and "_".'), | ||
inverse_match=True, | ||
) | ||
username_first_char_validator = RegexValidator( | ||
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 "_".') | ||
) | ||
no_consequtive = RegexValidator( | ||
r"[_.]{2,}", | ||
_("Username must not contain consecutive . or _ characters."), | ||
inverse_match=True, | ||
) | ||
|
||
|
||
class RegistrationForm(RegistrationFormUniqueEmail): | ||
|
||
username = forms.CharField( | ||
max_length=32, | ||
min_length=3, | ||
strip=False, | ||
validators=[ | ||
username_validator, | ||
username_first_char_validator, | ||
username_last_char_validator, | ||
no_consequtive, | ||
], | ||
) | ||
|
||
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-28 17:29+0200\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 "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." | ||
msgstr "" | ||
|
||
msgid "Username must start with a letter." | ||
msgstr "" | ||
|
||
msgid "Username must end with a letter, a number or \"_\"." | ||
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-28 17:29+0200\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 "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." | ||
msgstr "Ungültiger Benutzername. Erlaubte Zeichen sind Buchstaben, Ziffern, \".\" and \".\"." | ||
|
||
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." | ||
|
||
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-28 17:29+0200\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 "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." | ||
msgstr "" | ||
|
||
msgid "Username must start with a letter." | ||
msgstr "" | ||
|
||
msgid "Username must end with a letter, a number or \"_\"." | ||
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-28 17:29+0200\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 "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." | ||
msgstr "" | ||
|
||
msgid "Username must start with a letter." | ||
msgstr "" | ||
|
||
msgid "Username must end with a letter, a number or \"_\"." | ||
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-28 17:29+0200\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 "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." | ||
msgstr "" | ||
|
||
msgid "Username must start with a letter." | ||
msgstr "" | ||
|
||
msgid "Username must end with a letter, a number or \"_\"." | ||
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-28 17:29+0200\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 "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." | ||
msgstr "" | ||
|
||
msgid "Username must start with a letter." | ||
msgstr "" | ||
|
||
msgid "Username must end with a letter, a number or \"_\"." | ||
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-28 17:29+0200\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 "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." | ||
msgstr "" | ||
|
||
msgid "Username must start with a letter." | ||
msgstr "" | ||
|
||
msgid "Username must end with a letter, a number or \"_\"." | ||
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-28 17:29+0200\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 "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." | ||
msgstr "" | ||
|
||
msgid "Username must start with a letter." | ||
msgstr "" | ||
|
||
msgid "Username must end with a letter, a number or \"_\"." | ||
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-28 17:29+0200\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 "Invalid username. Allowed characters are letters, numbers, \".\" and \"_\"." | ||
msgstr "" | ||
|
||
msgid "Username must start with a letter." | ||
msgstr "" | ||
|
||
msgid "Username must end with a letter, a number or \"_\"." | ||
msgstr "" | ||
|
||
msgid "Username must not contain consecutive . or _ characters." | ||
msgstr "" | ||
|
||
msgid "Accept privacy policy" | ||
msgstr "" | ||
|
||
|
Oops, something went wrong.