fix: Add csrf_exempt to login view

This commit is contained in:
jhynsoo 2023-11-14 20:48:21 +09:00
parent f5913f2383
commit 30a7f5cd3e

View File

@ -1,4 +1,7 @@
from django.contrib.auth import authenticate, login, logout
from django.views.decorators.csrf import csrf_exempt
from django.utils.decorators import method_decorator
from rest_framework.decorators import action
from rest_framework.permissions import AllowAny, IsAdminUser, IsAuthenticated
@ -77,6 +80,7 @@ class UserViewset(ActionBasedMixin, ModelViewSet):
return Response(serializer.data)
@action(detail=False, methods=["POST"])
@method_decorator(csrf_exempt)
def login(self, request):
username = request.data["username"]
password = request.data["password"]