mirror of
https://github.com/Tivix/django-rest-auth.git
synced 2024-11-22 00:56:34 +03:00
RegisterView email send on sign up fix
This commit is contained in:
parent
479a40d2cc
commit
6c913d537e
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -102,3 +102,6 @@ venv.bak/
|
|||
|
||||
# mypy
|
||||
.mypy_cache/
|
||||
|
||||
# Pycharm
|
||||
.idea
|
||||
|
|
|
@ -13,7 +13,7 @@ from rest_framework import status
|
|||
|
||||
from allauth.account.adapter import get_adapter
|
||||
from allauth.account.views import ConfirmEmailView
|
||||
from allauth.account.utils import complete_signup
|
||||
from allauth.account.utils import complete_signup, send_email_confirmation
|
||||
from allauth.account import app_settings as allauth_settings
|
||||
from allauth.socialaccount import signals
|
||||
from allauth.socialaccount.adapter import get_adapter as get_social_adapter
|
||||
|
@ -76,6 +76,17 @@ class RegisterView(CreateAPIView):
|
|||
else:
|
||||
create_token(self.token_model, user, serializer)
|
||||
|
||||
account_email_verification = getattr(
|
||||
settings,
|
||||
'ACCOUNT_EMAIL_VERIFICATION',
|
||||
allauth_settings.EmailVerificationMethod.OPTIONAL
|
||||
)
|
||||
send_email_required = (
|
||||
allauth_settings.EmailVerificationMethod.MANDATORY,
|
||||
allauth_settings.EmailVerificationMethod.OPTIONAL
|
||||
)
|
||||
if account_email_verification in send_email_required:
|
||||
send_email_confirmation(self.request._request, user, True)
|
||||
complete_signup(self.request._request, user,
|
||||
allauth_settings.EMAIL_VERIFICATION,
|
||||
None)
|
||||
|
|
Loading…
Reference in New Issue
Block a user