Feature: Add pin-creation from remote-url

+ Add CSRF protection for every request
This commit is contained in:
winkidney
2019-12-04 22:48:23 +08:00
committed by Isaac Bythewood
parent 5282ed5e53
commit bb24ed3ecf
9 changed files with 279 additions and 24 deletions

11
pinry/middleware.py Normal file
View 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