mirror of
https://github.com/i701/sarlink-portal-api.git
synced 2025-04-19 23:46:53 +00:00
Add mobile number check in VerifyOTPView to prevent duplicate registrations
All checks were successful
Build and Push Docker Images / Build and Push Docker Images (push) Successful in 3m45s
All checks were successful
Build and Push Docker Images / Build and Push Docker Images (push) Successful in 3m45s
This commit is contained in:
parent
7777545bec
commit
900a87466f
11
api/views.py
11
api/views.py
@ -206,7 +206,16 @@ class VerifyOTPView(generics.GenericAPIView):
|
||||
serializer = self.get_serializer(data=request.data)
|
||||
serializer.is_valid(raise_exception=True)
|
||||
data = request.data
|
||||
print(data)
|
||||
mobile = data.get("mobile")
|
||||
|
||||
if (
|
||||
User.objects.filter(mobile=mobile).exists()
|
||||
or TemporaryUser.objects.filter(t_mobile=mobile).exists()
|
||||
):
|
||||
return Response(
|
||||
{"message": "User with this mobile number already registered."},
|
||||
status=400,
|
||||
)
|
||||
try:
|
||||
temp_user = TemporaryUser.objects.get(t_mobile=data["mobile"])
|
||||
except TemporaryUser.DoesNotExist:
|
||||
|
Loading…
x
Reference in New Issue
Block a user