SciPost Code Repository

Skip to content
Snippets Groups Projects
Commit 5ddf437e authored by Jorran de Wit's avatar Jorran de Wit
Browse files

Merge branch 'login' into development

parents 9e512a09 c19b01ff
No related branches found
No related tags found
No related merge requests found
...@@ -307,7 +307,17 @@ class AuthenticationForm(forms.Form): ...@@ -307,7 +307,17 @@ class AuthenticationForm(forms.Form):
""" """
username = self.cleaned_data['username'] username = self.cleaned_data['username']
password = self.cleaned_data['password'] password = self.cleaned_data['password']
return authenticate(username=username, password=password) user = authenticate(username=username, password=password)
if user:
return user
try:
_user = User.objects.get(email=username)
return authenticate(username=_user.username, password=password)
except:
# Catch all exceptions. This method should be upgraded in the next Django
# update anyway and not a single exception should propagate to the user, never!
return None
def get_redirect_url(self, request): def get_redirect_url(self, request):
""" """
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment