passcode add

This commit is contained in:
jain
2023-07-12 16:43:16 +05:30
parent 8720de4834
commit 81e314878e
3 changed files with 9 additions and 7 deletions

View File

@ -297,6 +297,7 @@ class UserLogin(viewsets.ViewSet):
email_verified.otp = otp
email_verified.save()
data.update({"email_otp":otp})
send_otp_email(username, otp)
return custom_response(ERROR_CODE['2024'], {"email_otp": otp, "is_email_verified": is_verified},
response_status=status.HTTP_200_OK)
data.update({"is_email_verified": is_verified})

View File

@ -119,7 +119,7 @@ class CreateGuardianSerializer(serializers.ModelSerializer):
"""Complete profile of the junior if below all data are filled"""
complete_profile_field = all([guardian.phone, guardian.gender, guardian.country_name,
guardian.dob, guardian.country_code, user.first_name, user.last_name,
user.email, guardian.image, guardian.passcode])
user.email, guardian.image])
guardian.is_complete_profile = False
if complete_profile_field:
guardian.is_complete_profile = True
@ -229,7 +229,7 @@ class GuardianProfileSerializer(serializers.ModelSerializer):
def get_complete_field_count(self, obj):
"""total filled fields count"""
total_field_list = [obj.user.first_name, obj.user.last_name, obj.user.email, obj.country_name, obj.country_code,
obj.phone, obj.gender, obj.dob, obj.image, obj.passcode]
obj.phone, obj.gender, obj.dob, obj.image]
total_complete_field = [data for data in total_field_list if data != '' and data is not None]
return len(total_complete_field)
@ -243,4 +243,4 @@ class GuardianProfileSerializer(serializers.ModelSerializer):
fields = ['id', 'email', 'first_name', 'last_name', 'country_name','country_code', 'phone', 'gender', 'dob',
'guardian_code', 'notification_count', 'total_count', 'complete_field_count', 'referral_code',
'is_active', 'is_complete_profile', 'created_at', 'image', 'signup_method',
'updated_at']
'updated_at', 'passcode']

View File

@ -93,7 +93,7 @@ class CreateJuniorSerializer(serializers.ModelSerializer):
"""Complete profile of the junior if below all data are filled"""
complete_profile_field = all([junior.phone, junior.gender, junior.country_name, junior.image,
junior.dob, junior.country_code, user.first_name, user.last_name,
user.email, junior.passcode])
user.email])
junior.is_complete_profile = False
if complete_profile_field:
junior.is_complete_profile = True
@ -224,12 +224,12 @@ class JuniorProfileSerializer(serializers.ModelSerializer):
def get_total_count(self, obj):
"""total fields count"""
return 10
return 9
def get_complete_field_count(self, obj):
"""total filled fields count"""
field_list = [obj.auth.first_name, obj.auth.last_name, obj.auth.email, obj.country_name, obj.country_code,
obj.phone, obj.gender, obj.dob, obj.image, obj.passcode]
obj.phone, obj.gender, obj.dob, obj.image]
complete_field = [data for data in field_list if data is not None and data != '']
return len(complete_field)
class Meta(object):
@ -237,4 +237,5 @@ class JuniorProfileSerializer(serializers.ModelSerializer):
model = Junior
fields = ['id', 'email', 'first_name', 'last_name', 'country_name', 'country_code', 'phone', 'gender', 'dob',
'guardian_code', 'referral_code','is_active', 'is_complete_profile', 'created_at', 'image',
'updated_at', 'notification_count', 'total_count', 'complete_field_count', 'signup_method']
'updated_at', 'notification_count', 'total_count', 'complete_field_count', 'signup_method',
'passcode']