|
|
|
@ -1,31 +1,30 @@ |
|
|
|
import os |
|
|
|
import os |
|
|
|
|
|
|
|
import logging |
|
|
|
from uuid import uuid4 |
|
|
|
from uuid import uuid4 |
|
|
|
from urllib.parse import urlsplit |
|
|
|
from urllib.parse import urlsplit |
|
|
|
|
|
|
|
|
|
|
|
from facepy import GraphAPI |
|
|
|
from facepy import GraphAPI |
|
|
|
from facepy.exceptions import FacepyError |
|
|
|
from facepy.exceptions import FacepyError |
|
|
|
|
|
|
|
|
|
|
|
from django.contrib.auth import get_user_model, logout, login, views |
|
|
|
from django.contrib.auth import get_user_model, logout, login, views |
|
|
|
from django.contrib.auth.forms import AuthenticationForm |
|
|
|
from django.contrib.auth.forms import AuthenticationForm |
|
|
|
from django.core.files.base import ContentFile |
|
|
|
from django.core.files.base import ContentFile |
|
|
|
from django.http import JsonResponse, Http404 |
|
|
|
from django.http import JsonResponse |
|
|
|
from django.urls import reverse_lazy |
|
|
|
from django.urls import reverse_lazy |
|
|
|
from django.utils.decorators import method_decorator |
|
|
|
from django.utils.decorators import method_decorator |
|
|
|
from django.views.decorators.csrf import csrf_exempt |
|
|
|
from django.views.decorators.csrf import csrf_exempt |
|
|
|
from django.views.generic import FormView, View, TemplateView |
|
|
|
from django.views.generic import FormView, View, TemplateView |
|
|
|
from django.views.generic.edit import BaseFormView |
|
|
|
|
|
|
|
from django.shortcuts import redirect |
|
|
|
from django.shortcuts import redirect |
|
|
|
from django.conf import settings |
|
|
|
from django.conf import settings |
|
|
|
|
|
|
|
|
|
|
|
from apps.notification.utils import send_email |
|
|
|
from apps.notification.utils import send_email |
|
|
|
from apps.config.models import Config |
|
|
|
from apps.config.models import Config |
|
|
|
from apps.user.models import Referral |
|
|
|
from apps.user.models import Referral |
|
|
|
|
|
|
|
|
|
|
|
from .forms import LearnerRegistrationForm |
|
|
|
from .forms import LearnerRegistrationForm |
|
|
|
from .tokens import verification_email_token |
|
|
|
from .tokens import verification_email_token |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
User = get_user_model() |
|
|
|
User = get_user_model() |
|
|
|
|
|
|
|
logger = logging.getLogger(__name__) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class LearnerRegistrationView(FormView): |
|
|
|
class LearnerRegistrationView(FormView): |
|
|
|
@ -75,7 +74,10 @@ class LearnerRegistrationView(FormView): |
|
|
|
http_referer = str(http_referer[0]) + '://' + str(http_referer[1]) |
|
|
|
http_referer = str(http_referer[0]) + '://' + str(http_referer[1]) |
|
|
|
token = verification_email_token.make_token(user) |
|
|
|
token = verification_email_token.make_token(user) |
|
|
|
url = http_referer + str(reverse_lazy('lilcity:verification-email', args=[token, user.id])) |
|
|
|
url = http_referer + str(reverse_lazy('lilcity:verification-email', args=[token, user.id])) |
|
|
|
send_email('Вы успешно прошли регистрацию', email, "notification/email/verification_email.html", url=url, config=config) |
|
|
|
try: |
|
|
|
|
|
|
|
send_email('Вы успешно прошли регистрацию', email, "notification/email/verification_email.html", url=url, config=config) |
|
|
|
|
|
|
|
except Exception as e: |
|
|
|
|
|
|
|
logger.error(str(e)) |
|
|
|
|
|
|
|
|
|
|
|
if self.request.is_ajax(): |
|
|
|
if self.request.is_ajax(): |
|
|
|
return JsonResponse({"success": True}, status=201) |
|
|
|
return JsonResponse({"success": True}, status=201) |
|
|
|
|