mirror of
https://github.com/retspen/webvirtcloud
synced 2025-07-31 12:41:08 +00:00
Update middleware.py
created new DisableCSRFMiddleware to mitigate CSRF cookie error after login
This commit is contained in:
parent
4646597b39
commit
2997e130ff
1 changed files with 10 additions and 0 deletions
|
|
@ -19,3 +19,13 @@ class ExceptionMiddleware:
|
||||||
)
|
)
|
||||||
return render(request, "500.html", status=500)
|
return render(request, "500.html", status=500)
|
||||||
# TODO: check connecting to host via VPN
|
# TODO: check connecting to host via VPN
|
||||||
|
|
||||||
|
|
||||||
|
class DisableCSRFMiddleware(object):
|
||||||
|
def __init__(self, get_response):
|
||||||
|
self.get_response = get_response
|
||||||
|
|
||||||
|
def __call__(self, request):
|
||||||
|
setattr(request, '_dont_enforce_csrf_checks', True)
|
||||||
|
response = self.get_response(request)
|
||||||
|
return response
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue