diff --git a/apps/auth/forms.py b/apps/auth/forms.py index 6977a3c2..e369a8f9 100644 --- a/apps/auth/forms.py +++ b/apps/auth/forms.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() diff --git a/apps/auth/views.py b/apps/auth/views.py index acb7712d..379ab0a5 100644 --- a/apps/auth/views.py +++ b/apps/auth/views.py @@ -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', '')