mirror of
https://github.com/HamzaSha1/zod-backend.git
synced 2025-11-26 08:34:55 +00:00
forgot password and email verification
This commit is contained in:
@ -3,12 +3,19 @@ from django.conf import settings
|
||||
import random
|
||||
from rest_framework import viewsets, status
|
||||
from rest_framework.response import Response
|
||||
|
||||
from templated_email import send_templated_mail
|
||||
def send_otp_email(recipient_email, otp):
|
||||
subject = 'One-Time Password'
|
||||
message = f'Your OTP is: {otp}'
|
||||
from_email = settings.DEFAULT_FROM_EMAIL
|
||||
from_email = settings.EMAIL_HOST_USER
|
||||
recipient_list = [recipient_email]
|
||||
send_mail(subject, message, from_email, recipient_list)
|
||||
send_templated_mail(
|
||||
template_name='email_otp_verification.email',
|
||||
from_email=from_email,
|
||||
recipient_list=recipient_list,
|
||||
context={
|
||||
'otp': otp
|
||||
}
|
||||
)
|
||||
return otp
|
||||
|
||||
def custom_response(detail, data=None, response_status=status.HTTP_200_OK):
|
||||
|
||||
Reference in New Issue
Block a user