feat: implement custom user model with JWT authentication and registration endpoints

This commit is contained in:
Your Name
2026-04-09 14:10:52 +05:30
parent 6bf186806b
commit f1c3b3f9f2
14 changed files with 242 additions and 4 deletions
+21
View File
@@ -0,0 +1,21 @@
from django.contrib.auth import get_user_model
from rest_framework import generics, permissions
from .serializers import UserSerializer
User = get_user_model()
class RegisterView(generics.CreateAPIView):
queryset = User.objects.all()
permission_classes = (permissions.AllowAny,)
serializer_class = UserSerializer
class MeView(generics.RetrieveAPIView):
serializer_class = UserSerializer
permission_classes = (permissions.IsAuthenticated,)
def get_object(self):
# Returns the user associated with the JWT token in the request
return self.request.user