mirror of
https://github.com/HamzaSha1/zod-backend.git
synced 2025-07-15 18:07:02 +00:00
added optional user as name
This commit is contained in:
@ -14,7 +14,7 @@ from account.models import UserEmailOtp
|
||||
from base.constants import USER_TYPE
|
||||
from base.messages import ERROR_CODE
|
||||
from guardian.tasks import generate_otp
|
||||
from base.tasks import send_email_otp
|
||||
from base.tasks import send_mail
|
||||
|
||||
USER = get_user_model()
|
||||
|
||||
@ -48,11 +48,13 @@ class AdminOTPSerializer(serializers.ModelSerializer):
|
||||
:return: user_data
|
||||
"""
|
||||
email = validated_data['email']
|
||||
|
||||
verification_code = generate_otp()
|
||||
|
||||
template = 'email_reset_verification.email'
|
||||
# Send the verification code to the user's email
|
||||
send_email_otp.delay(email, verification_code)
|
||||
data = {
|
||||
"verification_code": verification_code
|
||||
}
|
||||
send_mail.delay([email], template, data)
|
||||
|
||||
expiry = timezone.now() + timezone.timedelta(days=1)
|
||||
user_data, created = UserEmailOtp.objects.update_or_create(email=email,
|
||||
|
Reference in New Issue
Block a user