changes in task list API and add special character in password for added junior

This commit is contained in:
jain
2023-09-04 15:02:47 +05:30
parent 7b75a3233c
commit 20fa6e43da
4 changed files with 48 additions and 10 deletions

View File

@ -11,7 +11,7 @@ from django.utils import timezone
from rest_framework_simplejwt.tokens import RefreshToken
# local imports
from account.utils import send_otp_email, generate_code
from account.utils import send_otp_email, generate_code, make_special_password
from junior.models import Junior, JuniorPoints, JuniorGuardianRelationship, JuniorArticlePoints, FAQ
from guardian.tasks import generate_otp
from base.messages import ERROR_CODE, SUCCESS_CODE
@ -297,8 +297,8 @@ class AddJuniorSerializer(serializers.ModelSerializer):
user_data = User.objects.create(username=email, email=email,
first_name=self.context['first_name'],
last_name=self.context['last_name'])
password = User.objects.make_random_password()
user_data.set_password(password)
special_password = make_special_password()
user_data.set_password(special_password)
user_data.save()
junior_data = Junior.objects.create(auth=user_data, gender=validated_data.get('gender'),
image=profile_image,
@ -321,7 +321,7 @@ class AddJuniorSerializer(serializers.ModelSerializer):
# add push notification
UserNotification.objects.get_or_create(user=user_data)
"""Notification email"""
junior_notification_email.delay(email, full_name, email, password)
junior_notification_email.delay(email, full_name, email, special_password)
# push notification
send_notification.delay(ASSOCIATE_JUNIOR, None, None, junior_data.auth.id, {})
return junior_data