From 37d6a13cbf34fcef14ee3b095f3749b1c28f1b2a Mon Sep 17 00:00:00 2001 From: Simon Date: Sat, 10 Aug 2024 17:18:00 +0200 Subject: [PATCH] ignore csrf on login view --- backend/user/views.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/backend/user/views.py b/backend/user/views.py index 5c703d0d..37335c85 100644 --- a/backend/user/views.py +++ b/backend/user/views.py @@ -1,6 +1,8 @@ """all user api views""" from common.views import ApiBaseView +from django.utils.decorators import method_decorator +from django.views.decorators.csrf import csrf_exempt from rest_framework.authtoken.models import Token from rest_framework.authtoken.views import ObtainAuthToken from rest_framework.response import Response @@ -49,6 +51,7 @@ class UserConfigView(ApiBaseView): return Response(response) +@method_decorator(csrf_exempt, name='dispatch') class LoginApiView(ObtainAuthToken): """resolves to /api/user/login/ POST: return token and username after successful login