mirror of
https://github.com/HamzaSha1/zod-backend.git
synced 2025-11-27 00:54:54 +00:00
passcode add
This commit is contained in:
@ -297,6 +297,7 @@ class UserLogin(viewsets.ViewSet):
|
|||||||
email_verified.otp = otp
|
email_verified.otp = otp
|
||||||
email_verified.save()
|
email_verified.save()
|
||||||
data.update({"email_otp":otp})
|
data.update({"email_otp":otp})
|
||||||
|
send_otp_email(username, otp)
|
||||||
return custom_response(ERROR_CODE['2024'], {"email_otp": otp, "is_email_verified": is_verified},
|
return custom_response(ERROR_CODE['2024'], {"email_otp": otp, "is_email_verified": is_verified},
|
||||||
response_status=status.HTTP_200_OK)
|
response_status=status.HTTP_200_OK)
|
||||||
data.update({"is_email_verified": is_verified})
|
data.update({"is_email_verified": is_verified})
|
||||||
|
|||||||
@ -119,7 +119,7 @@ class CreateGuardianSerializer(serializers.ModelSerializer):
|
|||||||
"""Complete profile of the junior if below all data are filled"""
|
"""Complete profile of the junior if below all data are filled"""
|
||||||
complete_profile_field = all([guardian.phone, guardian.gender, guardian.country_name,
|
complete_profile_field = all([guardian.phone, guardian.gender, guardian.country_name,
|
||||||
guardian.dob, guardian.country_code, user.first_name, user.last_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
|
guardian.is_complete_profile = False
|
||||||
if complete_profile_field:
|
if complete_profile_field:
|
||||||
guardian.is_complete_profile = True
|
guardian.is_complete_profile = True
|
||||||
@ -229,7 +229,7 @@ class GuardianProfileSerializer(serializers.ModelSerializer):
|
|||||||
def get_complete_field_count(self, obj):
|
def get_complete_field_count(self, obj):
|
||||||
"""total filled fields count"""
|
"""total filled fields count"""
|
||||||
total_field_list = [obj.user.first_name, obj.user.last_name, obj.user.email, obj.country_name, obj.country_code,
|
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]
|
total_complete_field = [data for data in total_field_list if data != '' and data is not None]
|
||||||
return len(total_complete_field)
|
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',
|
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',
|
'guardian_code', 'notification_count', 'total_count', 'complete_field_count', 'referral_code',
|
||||||
'is_active', 'is_complete_profile', 'created_at', 'image', 'signup_method',
|
'is_active', 'is_complete_profile', 'created_at', 'image', 'signup_method',
|
||||||
'updated_at']
|
'updated_at', 'passcode']
|
||||||
|
|||||||
@ -93,7 +93,7 @@ class CreateJuniorSerializer(serializers.ModelSerializer):
|
|||||||
"""Complete profile of the junior if below all data are filled"""
|
"""Complete profile of the junior if below all data are filled"""
|
||||||
complete_profile_field = all([junior.phone, junior.gender, junior.country_name, junior.image,
|
complete_profile_field = all([junior.phone, junior.gender, junior.country_name, junior.image,
|
||||||
junior.dob, junior.country_code, user.first_name, user.last_name,
|
junior.dob, junior.country_code, user.first_name, user.last_name,
|
||||||
user.email, junior.passcode])
|
user.email])
|
||||||
junior.is_complete_profile = False
|
junior.is_complete_profile = False
|
||||||
if complete_profile_field:
|
if complete_profile_field:
|
||||||
junior.is_complete_profile = True
|
junior.is_complete_profile = True
|
||||||
@ -224,12 +224,12 @@ class JuniorProfileSerializer(serializers.ModelSerializer):
|
|||||||
|
|
||||||
def get_total_count(self, obj):
|
def get_total_count(self, obj):
|
||||||
"""total fields count"""
|
"""total fields count"""
|
||||||
return 10
|
return 9
|
||||||
|
|
||||||
def get_complete_field_count(self, obj):
|
def get_complete_field_count(self, obj):
|
||||||
"""total filled fields count"""
|
"""total filled fields count"""
|
||||||
field_list = [obj.auth.first_name, obj.auth.last_name, obj.auth.email, obj.country_name, obj.country_code,
|
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 != '']
|
complete_field = [data for data in field_list if data is not None and data != '']
|
||||||
return len(complete_field)
|
return len(complete_field)
|
||||||
class Meta(object):
|
class Meta(object):
|
||||||
@ -237,4 +237,5 @@ class JuniorProfileSerializer(serializers.ModelSerializer):
|
|||||||
model = Junior
|
model = Junior
|
||||||
fields = ['id', 'email', 'first_name', 'last_name', 'country_name', 'country_code', 'phone', 'gender', 'dob',
|
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',
|
'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']
|
||||||
|
|||||||
Reference in New Issue
Block a user