Compare commits

...
Author SHA1 Message Date
Ankitajain-kiwi a41e3a6f14 Merge branch 'dev' into 26june_sprint1 2023-06-27 20:18:04 +05:30
jain 7b02b7dfbc changes in setting.py file 2023-06-27 20:16:35 +05:30
Ankitajain-kiwi 3852e9bf03 Merge pull request #9 from KiwiTechLLC/26june_sprint1
26june sprint1
2023-06-27 19:34:27 +05:30
jain d208e5252c jira-13 update country name 2023-06-27 19:32:57 +05:30
jain 7b6d34f334 setting changes 2023-06-27 17:37:12 +05:30
jain 0006208cf8 Merge branch 'dev' of github.com:KiwiTechLLC/ZODBank-Backend into 26june_sprint1 2023-06-27 17:31:00 +05:30
Ankitajain-kiwi 352de6d630 Merge pull request #8 from KiwiTechLLC/server_demo
changes
2023-06-27 17:28:51 +05:30
jain 019d028cb6 jira-5 google login 2023-06-27 17:22:59 +05:30
Ankitajain-kiwi e1e5b1838a Merge pull request #7 from KiwiTechLLC/server_demo
changes docker file position
2023-06-27 16:54:39 +05:30
jain 4537f1f4fa changes 2023-06-27 16:45:42 +05:30
10 changed files with 98 additions and 9 deletions
+16
View File
@@ -13,6 +13,22 @@ from rest_framework.decorators import action
from django.contrib.auth import authenticate, login from django.contrib.auth import authenticate, login
from rest_framework_simplejwt.tokens import RefreshToken from rest_framework_simplejwt.tokens import RefreshToken
class GoogleSignInSerializer(serializers.Serializer):
"""Google login Serializer"""
email = serializers.EmailField()
def create(self, validated_data):
"""Create or update user model"""
with transaction.atomic():
print("validated_data====>",validated_data)
if User.objects.filter(email__iexact=self.validated_data['email']).exists():
return User.objects.get(email__iexact=self.validated_data['email'])
if not User.objects.filter(email__iexact=self.validated_data['email']).exists():
instance = User.objects.create(username=self.validated_data['email'],
email=self.validated_data['email'])
return instance
class ResetPasswordSerializer(serializers.Serializer): class ResetPasswordSerializer(serializers.Serializer):
"""Reset Password after verification""" """Reset Password after verification"""
+1
View File
@@ -12,6 +12,7 @@ router = routers.SimpleRouter()
"""API End points with router""" """API End points with router"""
router.register('user', UserLogin, basename='user') router.register('user', UserLogin, basename='user')
router.register('admin', UserLogin, basename='admin') router.register('admin', UserLogin, basename='admin')
# router.register('google-login', GoogleLoginAPIViewset, basename='admin')
router.register('send-phone-otp', SendPhoneOtp, basename='send-phone-otp') router.register('send-phone-otp', SendPhoneOtp, basename='send-phone-otp')
router.register('user-phone-verification', UserPhoneVerification, basename='user-phone-verification') router.register('user-phone-verification', UserPhoneVerification, basename='user-phone-verification')
router.register('user-email-verification', UserEmailVerification, basename='user-email-verification') router.register('user-email-verification', UserEmailVerification, basename='user-email-verification')
+25 -1
View File
@@ -8,7 +8,8 @@ from junior.models import Junior
from account.models import UserProfile, UserPhoneOtp, UserEmailOtp from account.models import UserProfile, UserPhoneOtp, UserEmailOtp
from django.contrib.auth.models import User from django.contrib.auth.models import User
from .serializers import (SuperUserSerializer, GuardianSerializer, JuniorSerializer, EmailVerificationSerializer, from .serializers import (SuperUserSerializer, GuardianSerializer, JuniorSerializer, EmailVerificationSerializer,
ForgotPasswordSerializer, ResetPasswordSerializer, ChangePasswordSerializer) ForgotPasswordSerializer, ResetPasswordSerializer, ChangePasswordSerializer,
GoogleSignInSerializer)
from rest_framework_simplejwt.tokens import RefreshToken from rest_framework_simplejwt.tokens import RefreshToken
from base.messages import ERROR_CODE, SUCCESS_CODE from base.messages import ERROR_CODE, SUCCESS_CODE
from guardian.tasks import generate_otp from guardian.tasks import generate_otp
@@ -21,6 +22,29 @@ from rest_framework.response import Response
from rest_framework.permissions import IsAuthenticated from rest_framework.permissions import IsAuthenticated
from templated_email import send_templated_mail from templated_email import send_templated_mail
# class GoogleLoginAPIViewset(viewsets.ModelViewSet):
# """Google Login"""
# serializer_class = GoogleSignInSerializer
#
# def create(self, request, *args, **kwargs):
# """
# Override default behaviour of create method
# """
# provider_type = []
# serializer = self.get_serializer(data=request.data)
# if serializer.is_valid(raise_exception=True):
# # provider = self.get_provider_view(request.data.get('provider'))
# # if User is not authenticated then send error message
# # if not provider.is_authenticated(request):
# # return custom_error_response({}, status.HTTP_400_BAD_REQUEST)
#
# user = serializer.save()
# if User.objects.filter(email__iexact=user.email).exists():
# print("ppppppppppppp")
# return custom_response(SUCCESS_CODE["3003"], response_status=status.HTTP_200_OK)
# return custom_response(ERROR_CODE["2002"], response_status=status.HTTP_400_BAD_REQUEST)
class ChangePasswordAPIView(views.APIView): class ChangePasswordAPIView(views.APIView):
permission_classes = [IsAuthenticated] permission_classes = [IsAuthenticated]
@@ -0,0 +1,18 @@
# Generated by Django 4.2.2 on 2023-06-27 13:59
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('guardian', '0002_remove_guardian_junior_code'),
]
operations = [
migrations.AddField(
model_name='guardian',
name='country_name',
field=models.CharField(blank=True, default=None, max_length=30, null=True),
),
]
+1
View File
@@ -13,6 +13,7 @@ class Guardian(models.Model):
"""Contact details""" """Contact details"""
country_code = models.IntegerField(blank=True, null=True) country_code = models.IntegerField(blank=True, null=True)
phone = models.CharField(max_length=31, null=True, blank=True, default=None) phone = models.CharField(max_length=31, null=True, blank=True, default=None)
country_name = models.CharField(max_length=30, null=True, blank=True, default=None)
"""Personal info""" """Personal info"""
family_name = models.CharField(max_length=50, null=True, blank=True, default=None) family_name = models.CharField(max_length=50, null=True, blank=True, default=None)
gender = models.CharField(choices=GENDERS, max_length=15, null=True, blank=True, default=None) gender = models.CharField(choices=GENDERS, max_length=15, null=True, blank=True, default=None)
+1
View File
@@ -99,6 +99,7 @@ class CreateGuardianSerializer(serializers.ModelSerializer):
guardian.phone = validated_data.get('phone', guardian.phone) guardian.phone = validated_data.get('phone', guardian.phone)
guardian.country_code = validated_data.get('country_code', guardian.country_code) guardian.country_code = validated_data.get('country_code', guardian.country_code)
guardian.passcode = validated_data.get('passcode', guardian.passcode) guardian.passcode = validated_data.get('passcode', guardian.passcode)
guardian.country_name = validated_data.get('country_name', guardian.country_name)
guardian.referral_code_used = validated_data.get('referral_code_used', guardian.referral_code_used) guardian.referral_code_used = validated_data.get('referral_code_used', guardian.referral_code_used)
"""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.family_name, complete_profile_field = all([guardian.phone, guardian.gender, guardian.family_name,
@@ -0,0 +1,18 @@
# Generated by Django 4.2.2 on 2023-06-27 13:59
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('junior', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='junior',
name='country_name',
field=models.CharField(blank=True, default=None, max_length=30, null=True),
),
]
+1
View File
@@ -14,6 +14,7 @@ class Junior(models.Model):
"""Contact details""" """Contact details"""
phone = models.CharField(max_length=31, null=True, blank=True, default=None) phone = models.CharField(max_length=31, null=True, blank=True, default=None)
country_code = models.IntegerField(blank=True, null=True) country_code = models.IntegerField(blank=True, null=True)
country_name = models.CharField(max_length=30, null=True, blank=True, default=None)
"""Personal info""" """Personal info"""
gender = models.CharField(max_length=10, choices=GENDERS, null=True, blank=True, default=None) gender = models.CharField(max_length=10, choices=GENDERS, null=True, blank=True, default=None)
dob = models.DateField(max_length=15, null=True, blank=True, default=None) dob = models.DateField(max_length=15, null=True, blank=True, default=None)
+1
View File
@@ -72,6 +72,7 @@ class CreateJuniorSerializer(serializers.ModelSerializer):
junior.guardian_code = validated_data.get('guardian_code', junior.guardian_code) junior.guardian_code = validated_data.get('guardian_code', junior.guardian_code)
junior.dob = validated_data.get('dob',junior.dob) junior.dob = validated_data.get('dob',junior.dob)
junior.passcode = validated_data.get('passcode', junior.passcode) junior.passcode = validated_data.get('passcode', junior.passcode)
junior.country_name = validated_data.get('country_name', junior.country_name)
"""Update country code and phone number""" """Update country code and phone number"""
junior.phone = validated_data.get('phone', junior.phone) junior.phone = validated_data.get('phone', junior.phone)
junior.country_code = validated_data.get('country_code', junior.country_code) junior.country_code = validated_data.get('country_code', junior.country_code)
+16 -8
View File
@@ -173,12 +173,20 @@ https://docs.djangoproject.com/en/3.0/howto/static-files/"""
# Email settings # Email settings
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' # EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.gmail.com' # EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587 # EMAIL_PORT = 587
EMAIL_USE_TLS = True # EMAIL_USE_TLS = True
EMAIL_HOST_USER = '[email protected]' # EMAIL_HOST_USER = '[email protected]'
# Replace with your Gmail email password or App password # # Replace with your Gmail email password or App password
EMAIL_HOST_PASSWORD = 'ghwdmznwwslvchga' # EMAIL_HOST_PASSWORD = 'ghwdmznwwslvchga'
EMAIL_USE_TLS = os.getenv('EMAIL_USE_TLS')
EMAIL_HOST = os.getenv('EMAIL_HOST')
EMAIL_HOST_USER = os.getenv('EMAIL_HOST_USER')
EMAIL_HOST_PASSWORD = os.getenv('EMAIL_HOST_PASSWORD')
EMAIL_PORT = os.getenv('EMAIL_PORT')
STATIC_URL = 'static/'
STATIC_ROOT = 'static'
STATIC_URL = '/static/'