|
|
|
|
@ -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: |
|
|
|
|
|