gold eggs backend
Some checks failed
Build and Push to Docker Hub / build-test-push (push) Failing after 1m55s
Some checks failed
Build and Push to Docker Hub / build-test-push (push) Failing after 1m55s
This commit is contained in:
25
core/http/views/auth.py
Normal file
25
core/http/views/auth.py
Normal file
@@ -0,0 +1,25 @@
|
||||
from django.utils.translation import gettext as _
|
||||
from rest_framework import views
|
||||
from rest_framework import request
|
||||
from rest_framework import throttling
|
||||
|
||||
from core import enums
|
||||
from core import services
|
||||
from core.http import serializers
|
||||
from core.http.views import generics as http_views
|
||||
|
||||
|
||||
class AbstractSendSms(views.APIView, http_views.ApiResponse):
|
||||
serializer_class = serializers.ResendSerializer
|
||||
throttle_classes = [throttling.UserRateThrottle]
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
self.service = services.UserService()
|
||||
|
||||
def post(self, request: request.Request):
|
||||
ser = self.serializer_class(data=request.data)
|
||||
ser.is_valid(raise_exception=True)
|
||||
phone = ser.data.get("phone")
|
||||
self.service.send_confirmation(phone)
|
||||
return self.success(_(enums.Messages.SEND_MESSAGE) % {"phone": phone})
|
||||
Reference in New Issue
Block a user