From 81e314878e848e4c4f6ba89c5d23133a6a081263 Mon Sep 17 00:00:00 2001 From: jain Date: Wed, 12 Jul 2023 16:43:16 +0530 Subject: [PATCH] passcode add --- account/views.py | 1 + guardian/serializers.py | 6 +++--- junior/serializers.py | 9 +++++---- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/account/views.py b/account/views.py index c2739d6..aab69fb 100644 --- a/account/views.py +++ b/account/views.py @@ -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}) diff --git a/guardian/serializers.py b/guardian/serializers.py index 5b737c6..9ba837f 100644 --- a/guardian/serializers.py +++ b/guardian/serializers.py @@ -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'] diff --git a/junior/serializers.py b/junior/serializers.py index 13aa594..cf936cb 100644 --- a/junior/serializers.py +++ b/junior/serializers.py @@ -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']