Merge branch 'hotfix/lil-600' into 'master'

LIL-600 Игнорировать заглавные буквы в email; refactoring

See merge request lilcity/backend!97
remotes/origin/hotfix/LIL-661
cfwme 8 years ago
commit 740337c010
  1. 7
      apps/auth/forms.py
  2. 5
      apps/auth/views.py

@ -1,5 +1,4 @@
from django import forms
from django.contrib.auth.forms import AuthenticationForm
class LearnerRegistrationForm(forms.Form):
@ -7,9 +6,3 @@ class LearnerRegistrationForm(forms.Form):
last_name = forms.CharField()
email = forms.EmailField()
password = forms.CharField()
class AuthenticationForm(AuthenticationForm):
def clean_username(self):
return self.cleaned_data.get('username', '').lower()

@ -7,6 +7,7 @@ from facepy import GraphAPI
from facepy.exceptions import FacepyError
from django.contrib.auth import get_user_model, logout, login, views
from django.contrib.auth.forms import AuthenticationForm
from django.core.files.base import ContentFile
from django.http import JsonResponse
from django.urls import reverse_lazy
@ -19,7 +20,7 @@ from django.shortcuts import redirect
from apps.notification.utils import send_email
from apps.config.models import Config
from .forms import LearnerRegistrationForm, AuthenticationForm
from .forms import LearnerRegistrationForm
from .tokens import verification_email_token
User = get_user_model()
@ -171,7 +172,7 @@ class FacebookLoginOrRegistration(View):
else:
email = email.lower()
try:
user = User.objects.get(email=email)
user = User.objects.get(email__iexact=email)
except User.DoesNotExist:
first_name = data.get('first_name', '')
last_name = data.get('last_name', '')

Loading…
Cancel
Save