feat: add user registration, profile management, and WhatsApp OTP authentication views
All checks were successful
Deploy Beta (NATIVE) / deploy (push) Successful in 23s
All checks were successful
Deploy Beta (NATIVE) / deploy (push) Successful in 23s
This commit is contained in:
parent
3ac7e6eb8f
commit
9de95a7408
1 changed files with 7 additions and 0 deletions
|
|
@ -21,6 +21,13 @@ class UserRegisterView(APIView):
|
|||
serializer.save()
|
||||
audit_logger.info(f"AUDIT - User Register: Username '{serializer.validated_data.get('username')}' registered successfully.")
|
||||
return Response({"message": "User registered successfully"}, status=status.HTTP_201_CREATED)
|
||||
else:
|
||||
username = request.data.get('username')
|
||||
phone = request.data.get('phone', username)
|
||||
if username and User.objects.filter(username=username).exists():
|
||||
user = User.objects.get(username=username)
|
||||
CustomerProfile.objects.get_or_create(user=user, defaults={'phone': phone or username})
|
||||
return Response({"message": "User account already registered"}, status=status.HTTP_200_OK)
|
||||
return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
|
||||
|
||||
class UserProfileView(APIView):
|
||||
|
|
|
|||
Loading…
Reference in a new issue