From 19739c1dce758d060d3a60daf6c11417e0e65893 Mon Sep 17 00:00:00 2001 From: gzbender Date: Thu, 9 Aug 2018 16:08:36 +0500 Subject: [PATCH] =?UTF-8?q?LIL-600=20=D0=98=D0=B3=D0=BD=D0=BE=D1=80=D0=B8?= =?UTF-8?q?=D1=80=D0=BE=D0=B2=D0=B0=D1=82=D1=8C=20=D0=B7=D0=B0=D0=B3=D0=BB?= =?UTF-8?q?=D0=B0=D0=B2=D0=BD=D1=8B=D0=B5=20=D0=B1=D1=83=D0=BA=D0=B2=D1=8B?= =?UTF-8?q?=20=D0=B2=20email;=20refactoring?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/auth/forms.py | 7 ------- apps/auth/views.py | 5 +++-- 2 files changed, 3 insertions(+), 9 deletions(-) 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', '')