added task to send otp on email

This commit is contained in:
abutalib-kiwi
2023-07-27 12:56:50 +05:30
parent c079f3ceca
commit 68b77ef766
4 changed files with 43 additions and 24 deletions

29
base/tasks.py Normal file
View File

@ -0,0 +1,29 @@
"""
web_admin tasks file
"""
# third party imports
from celery import shared_task
from templated_email import send_templated_mail
# django imports
from django.conf import settings
@shared_task
def send_email_otp(email, verification_code):
"""
used to send otp on email
:param email: e-mail
:param verification_code: otp
"""
from_email = settings.EMAIL_FROM_ADDRESS
recipient_list = [email]
send_templated_mail(
template_name='email_reset_verification.email',
from_email=from_email,
recipient_list=recipient_list,
context={
'verification_code': verification_code
}
)
return True