Merge branch 'master' of https://gitlab.com/lilcity/backend into hotfix/LIL-601

remotes/origin/hotfix/LIL-691
gzbender 8 years ago
commit f22d9297d4
  1. 8
      apps/auth/forms.py
  2. 6
      apps/auth/views.py

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

@ -7,7 +7,6 @@ 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
@ -20,7 +19,7 @@ from django.shortcuts import redirect
from apps.notification.utils import send_email
from apps.config.models import Config
from .forms import LearnerRegistrationForm
from .forms import LearnerRegistrationForm, AuthenticationForm
from .tokens import verification_email_token
User = get_user_model()
@ -33,7 +32,7 @@ class LearnerRegistrationView(FormView):
def form_valid(self, form):
first_name = form.cleaned_data['first_name']
last_name = form.cleaned_data['last_name']
email = form.cleaned_data['email']
email = form.cleaned_data['email'].lower()
password = form.cleaned_data['password']
user, created = User.objects.get_or_create(
@ -170,6 +169,7 @@ class FacebookLoginOrRegistration(View):
"errors": {"email": 'is field required'}
})
else:
email = email.lower()
try:
user = User.objects.get(email=email)
except User.DoesNotExist:

Loading…
Cancel
Save