-
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 #531 from coders4help/develop
Apply fixes for release
- Loading branch information
Showing
48 changed files
with
1,321 additions
and
317 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
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import logging | ||
|
||
from django.contrib.auth.backends import ModelBackend, UserModel | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
class EmailAsUsernameModelBackend(ModelBackend): | ||
def authenticate(self, request, username=None, password=None, **kwargs): | ||
if username and "@" in username: | ||
try: | ||
user = UserModel._default_manager.get(email__iexact=username) | ||
return super().authenticate(request, user.username, password, **kwargs) | ||
except UserModel.DoesNotExist: | ||
logger.debug('No user with email address "%s"', username) | ||
except UserModel.MultipleObjectsReturned: | ||
logger.warning( | ||
'Found %s users with email address "%s"', | ||
UserModel._default_manager.filter(email=username).count(), | ||
username, | ||
) | ||
return None |
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-29 11:54+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 "" | ||
|
||
|
@@ -708,6 +720,9 @@ msgstr "" | |
msgid "scheduler" | ||
msgstr "" | ||
|
||
msgid "slots" | ||
msgstr "" | ||
|
||
msgid "number of needed volunteers" | ||
msgstr "" | ||
|
||
|
@@ -913,9 +928,6 @@ msgstr[1] "" | |
msgid "Something didn't work. Sorry about that." | ||
msgstr "" | ||
|
||
msgid "slots" | ||
msgstr "" | ||
|
||
msgid "from" | ||
msgstr "" | ||
|
||
|
@@ -1100,7 +1112,11 @@ msgstr "" | |
msgid "Your account is now approved. You can log in using the following link" | ||
msgstr "" | ||
|
||
msgid "Your username and password didn't match. Please try again." | ||
msgid "Email address" | ||
msgstr "" | ||
|
||
#, python-format | ||
msgid "%(email_trans)s / %(username_trans)s" | ||
msgstr "" | ||
|
||
msgid "Password" | ||
|
@@ -1121,9 +1137,6 @@ msgstr "" | |
msgid "Change Password" | ||
msgstr "" | ||
|
||
msgid "Email address" | ||
msgstr "" | ||
|
||
msgid "Change password" | ||
msgstr "" | ||
|
||
|
Oops, something went wrong.