mirror of
https://github.com/pinry/pinry.git
synced 2025-11-13 08:35:41 +01:00
12 lines
308 B
Python
12 lines
308 B
Python
from django.middleware.csrf import get_token
|
|
|
|
|
|
class ForceCSRFCookieMiddleware:
|
|
def process_request(self, request):
|
|
if "CSRF_TOKEN" not in request.META:
|
|
get_token(request)
|
|
else:
|
|
if request.method != "GET":
|
|
get_token(request)
|
|
return
|