django-chelseru 2.0.5__tar.gz → 2.0.6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. {django_chelseru-2.0.5/django_chelseru.egg-info → django_chelseru-2.0.6}/PKG-INFO +1 -1
  2. {django_chelseru-2.0.5 → django_chelseru-2.0.6/django_chelseru.egg-info}/PKG-INFO +1 -1
  3. {django_chelseru-2.0.5 → django_chelseru-2.0.6}/drfchelseru/serializers.py +28 -2
  4. {django_chelseru-2.0.5 → django_chelseru-2.0.6}/drfchelseru/urls.py +6 -1
  5. {django_chelseru-2.0.5 → django_chelseru-2.0.6}/drfchelseru/views.py +11 -3
  6. {django_chelseru-2.0.5 → django_chelseru-2.0.6}/setup.py +1 -1
  7. {django_chelseru-2.0.5 → django_chelseru-2.0.6}/LICENSE +0 -0
  8. {django_chelseru-2.0.5 → django_chelseru-2.0.6}/MANIFEST.in +0 -0
  9. {django_chelseru-2.0.5 → django_chelseru-2.0.6}/README.md +0 -0
  10. {django_chelseru-2.0.5 → django_chelseru-2.0.6}/README_PA.md +0 -0
  11. {django_chelseru-2.0.5 → django_chelseru-2.0.6}/django_chelseru.egg-info/SOURCES.txt +0 -0
  12. {django_chelseru-2.0.5 → django_chelseru-2.0.6}/django_chelseru.egg-info/dependency_links.txt +0 -0
  13. {django_chelseru-2.0.5 → django_chelseru-2.0.6}/django_chelseru.egg-info/requires.txt +0 -0
  14. {django_chelseru-2.0.5 → django_chelseru-2.0.6}/django_chelseru.egg-info/top_level.txt +0 -0
  15. {django_chelseru-2.0.5 → django_chelseru-2.0.6}/drfchelseru/__init__.py +0 -0
  16. {django_chelseru-2.0.5 → django_chelseru-2.0.6}/drfchelseru/admin.py +0 -0
  17. {django_chelseru-2.0.5 → django_chelseru-2.0.6}/drfchelseru/apps.py +0 -0
  18. {django_chelseru-2.0.5 → django_chelseru-2.0.6}/drfchelseru/consumers.py +0 -0
  19. {django_chelseru-2.0.5 → django_chelseru-2.0.6}/drfchelseru/middlewares.py +0 -0
  20. {django_chelseru-2.0.5 → django_chelseru-2.0.6}/drfchelseru/migrations/0001_initial.py +0 -0
  21. {django_chelseru-2.0.5 → django_chelseru-2.0.6}/drfchelseru/migrations/0002_otpcode_session_user.py +0 -0
  22. {django_chelseru-2.0.5 → django_chelseru-2.0.6}/drfchelseru/migrations/0003_rename_mobile_otpcode_mobile_number.py +0 -0
  23. {django_chelseru-2.0.5 → django_chelseru-2.0.6}/drfchelseru/migrations/0004_rename_message_message_sms.py +0 -0
  24. {django_chelseru-2.0.5 → django_chelseru-2.0.6}/drfchelseru/migrations/0005_rename_message_sms_messagesms_chatroom_messagechat.py +0 -0
  25. {django_chelseru-2.0.5 → django_chelseru-2.0.6}/drfchelseru/migrations/0006_alter_chatroom_user_1_alter_chatroom_user_2_and_more.py +0 -0
  26. {django_chelseru-2.0.5 → django_chelseru-2.0.6}/drfchelseru/migrations/0007_chatroom_pinned_for_chatroom_status_chatroom_users_and_more.py +0 -0
  27. {django_chelseru-2.0.5 → django_chelseru-2.0.6}/drfchelseru/migrations/0008_alter_chatroompermissions_user.py +0 -0
  28. {django_chelseru-2.0.5 → django_chelseru-2.0.6}/drfchelseru/migrations/0009_alter_chatroom_status.py +0 -0
  29. {django_chelseru-2.0.5 → django_chelseru-2.0.6}/drfchelseru/migrations/0010_chatroom_banneds_chatroom_descriptions_chatroom_name_and_more.py +0 -0
  30. {django_chelseru-2.0.5 → django_chelseru-2.0.6}/drfchelseru/migrations/0011_alter_chatroom_user_1_alter_chatroom_user_2.py +0 -0
  31. {django_chelseru-2.0.5 → django_chelseru-2.0.6}/drfchelseru/migrations/0012_payment.py +0 -0
  32. {django_chelseru-2.0.5 → django_chelseru-2.0.6}/drfchelseru/migrations/0013_payment_authority_payment_data_payment_status_code.py +0 -0
  33. {django_chelseru-2.0.5 → django_chelseru-2.0.6}/drfchelseru/migrations/0014_payment_gateway_title_payment_gateway_url.py +0 -0
  34. {django_chelseru-2.0.5 → django_chelseru-2.0.6}/drfchelseru/migrations/0015_payment_message.py +0 -0
  35. {django_chelseru-2.0.5 → django_chelseru-2.0.6}/drfchelseru/migrations/0016_payment_card_hash_payment_card_pan_and_more.py +0 -0
  36. {django_chelseru-2.0.5 → django_chelseru-2.0.6}/drfchelseru/migrations/0017_alter_payment_callback_url_alter_payment_gateway_url.py +0 -0
  37. {django_chelseru-2.0.5 → django_chelseru-2.0.6}/drfchelseru/migrations/0018_alter_payment_ref_id.py +0 -0
  38. {django_chelseru-2.0.5 → django_chelseru-2.0.6}/drfchelseru/migrations/0019_payment_created_at_payment_status_payment_updated_at.py +0 -0
  39. {django_chelseru-2.0.5 → django_chelseru-2.0.6}/drfchelseru/migrations/0020_payment_paid_at.py +0 -0
  40. {django_chelseru-2.0.5 → django_chelseru-2.0.6}/drfchelseru/migrations/0021_alter_payment_message.py +0 -0
  41. {django_chelseru-2.0.5 → django_chelseru-2.0.6}/drfchelseru/migrations/0022_payment_pay_mode_wallet.py +0 -0
  42. {django_chelseru-2.0.5 → django_chelseru-2.0.6}/drfchelseru/migrations/__init__.py +0 -0
  43. {django_chelseru-2.0.5 → django_chelseru-2.0.6}/drfchelseru/models.py +0 -0
  44. {django_chelseru-2.0.5 → django_chelseru-2.0.6}/drfchelseru/routing.py +0 -0
  45. {django_chelseru-2.0.5 → django_chelseru-2.0.6}/drfchelseru/services.py +0 -0
  46. {django_chelseru-2.0.5 → django_chelseru-2.0.6}/drfchelseru/settings.py +0 -0
  47. {django_chelseru-2.0.5 → django_chelseru-2.0.6}/drfchelseru/signals.py +0 -0
  48. {django_chelseru-2.0.5 → django_chelseru-2.0.6}/drfchelseru/tests.py +0 -0
  49. {django_chelseru-2.0.5 → django_chelseru-2.0.6}/drfchelseru/validators.py +0 -0
  50. {django_chelseru-2.0.5 → django_chelseru-2.0.6}/pyproject.toml +0 -0
  51. {django_chelseru-2.0.5 → django_chelseru-2.0.6}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: django-chelseru
3
- Version: 2.0.5
3
+ Version: 2.0.6
4
4
  Summary: Authentication system, online and real-time chat, SMS & BANK system for Iranian SMS services.
5
5
  Home-page: https://pipdjango.chelseru.com
6
6
  Author: Sobhan Bahman Rashnu
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: django-chelseru
3
- Version: 2.0.5
3
+ Version: 2.0.6
4
4
  Summary: Authentication system, online and real-time chat, SMS & BANK system for Iranian SMS services.
5
5
  Home-page: https://pipdjango.chelseru.com
6
6
  Author: Sobhan Bahman Rashnu
@@ -1,10 +1,12 @@
1
- from rest_framework.serializers import ModelSerializer
1
+ from rest_framework.serializers import ModelSerializer, CharField, ValidationError
2
2
  from django.contrib.auth.models import User
3
+ from django.contrib.auth.password_validation import validate_password
4
+ from django.contrib.auth import get_user_model
3
5
  from .models import User as mobile, OTPCode, Session, MessageSMS, ChatRoom, MessageChat, Payment
4
6
 
5
7
  # from django.contrib.auth import get_user_model
6
8
 
7
- # UserGet = get_user_model()
9
+ UserGet = get_user_model()
8
10
 
9
11
  class DefaultUserSerializer(ModelSerializer):
10
12
  class Meta:
@@ -58,3 +60,27 @@ class PaymentSerializer(MobileSerializer):
58
60
  class Meta:
59
61
  model = Payment
60
62
  fields = '__all__'
63
+
64
+
65
+ # Authentication method : Passwd
66
+ class RegisterSerializer(ModelSerializer):
67
+ password = CharField(write_only=True, required=True, validators=[validate_password])
68
+ password2 = CharField(write_only=True, required=True)
69
+
70
+ class Meta:
71
+ model = UserGet
72
+ fields = ('username', 'password', 'password2', 'email')
73
+
74
+ def validate(self, attrs):
75
+ if attrs['password'] != attrs['password2']:
76
+ raise ValidationError({"password": "رمز عبور و تکرار آن برابر نیستند."})
77
+ return attrs
78
+
79
+ def create(self, validated_data):
80
+ user = UserGet.objects.create(
81
+ username=validated_data['username'],
82
+ email=validated_data['email'],
83
+ )
84
+ user.set_password(validated_data['password'])
85
+ user.save()
86
+ return user
@@ -1,6 +1,8 @@
1
1
  from django.urls import path, include
2
2
  from rest_framework.routers import DefaultRouter
3
- from .views import MessageSend, OTPCodeSend ,Authentication, SessionList, MessageViewSet, ChatRoomViewSet, PaymentCreate, PaymentCallback
3
+ from rest_framework_simplejwt.views import TokenObtainPairView
4
+
5
+ from .views import MessageSend, OTPCodeSend ,Authentication, SessionList, MessageViewSet, ChatRoomViewSet, PaymentCreate, PaymentCallback, RegisterView
4
6
 
5
7
  app_name = 'drfchelseru'
6
8
 
@@ -14,6 +16,9 @@ urlpatterns = [
14
16
  path('otp/send/', OTPCodeSend.as_view(), name='otp-send'),
15
17
  path('authenticate/', Authentication.as_view(), name='auth'),
16
18
 
19
+ path('register/', RegisterView.as_view(), name='register-passwd'),
20
+ path('login/', TokenObtainPairView.as_view(), name='login-passwd'),
21
+
17
22
  path('sessions/', SessionList.as_view(), name='sessions'),
18
23
 
19
24
  path('payment/create/', PaymentCreate.as_view(), name='payment-create'),
@@ -1,18 +1,19 @@
1
1
  from rest_framework.viewsets import ModelViewSet
2
2
  from rest_framework.views import APIView
3
3
  from rest_framework.permissions import AllowAny, IsAuthenticated
4
- from rest_framework.generics import ListAPIView
4
+ from rest_framework.generics import ListAPIView, CreateAPIView
5
5
  from rest_framework.response import Response
6
6
  from rest_framework.status import HTTP_200_OK, HTTP_204_NO_CONTENT, HTTP_500_INTERNAL_SERVER_ERROR, HTTP_502_BAD_GATEWAY, HTTP_401_UNAUTHORIZED, HTTP_400_BAD_REQUEST, HTTP_409_CONFLICT, HTTP_404_NOT_FOUND
7
7
  from rest_framework.exceptions import NotFound, ValidationError
8
8
  from rest_framework import status
9
9
 
10
10
  from django.contrib.auth.models import User as UserDefault
11
+ from django.contrib.auth import get_user_model
11
12
 
12
13
  from .services import send_message, create_payment, verify_payment
13
14
  from .settings import sms_init_check, auth_init_check
14
15
  from .validators import mobile_number as mobile_validator
15
- from .serializers import MessageSerializer, OTPCodeSerializer, SessionSerializer, ChatRoomSerializer, MessageChatSerializer, PaymentSerializer
16
+ from .serializers import MessageSerializer, OTPCodeSerializer, SessionSerializer, ChatRoomSerializer, MessageChatSerializer, PaymentSerializer, RegisterSerializer
16
17
  from .models import User, ChatRoom
17
18
  from django.utils.timezone import now, timedelta
18
19
  from django.db import transaction, IntegrityError, OperationalError
@@ -24,6 +25,7 @@ import traceback
24
25
  import time
25
26
  import logging
26
27
 
28
+ UserGet = get_user_model()
27
29
 
28
30
  logger = logging.getLogger(__name__)
29
31
 
@@ -435,4 +437,10 @@ class PaymentCallback(APIView):
435
437
 
436
438
  except self.model.DoesNotExist:
437
439
  return Response({'error': 'payment not found.'}, status=HTTP_404_NOT_FOUND)
438
- return Response({})
440
+ return Response({})
441
+
442
+
443
+ # Authentication method : Passwd
444
+ class RegisterView(CreateAPIView):
445
+ queryset = UserGet.objects.all()
446
+ serializer_class = RegisterSerializer
@@ -3,7 +3,7 @@ from setuptools import setup, find_packages
3
3
 
4
4
  setup(
5
5
  name='django-chelseru',
6
- version='2.0.5',
6
+ version='2.0.6',
7
7
  packages=find_packages(),
8
8
  include_package_data=True,
9
9
  install_requires=[
File without changes