mirror of
https://github.com/pinry/pinry.git
synced 2025-11-13 16:45:41 +01:00
Feature: Add pin-creation from remote-url
+ Add CSRF protection for every request
This commit is contained in:
committed by
Isaac Bythewood
parent
5282ed5e53
commit
bb24ed3ecf
11
pinry/middleware.py
Normal file
11
pinry/middleware.py
Normal file
@@ -0,0 +1,11 @@
|
||||
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
|
||||
Reference in New Issue
Block a user