From 0ced09b9d28f7c48514afc61fba11854ba980d3f Mon Sep 17 00:00:00 2001 From: Benjamin Dauvergne Date: Tue, 1 Oct 2019 00:47:49 +0200 Subject: [PATCH] middleware: skip media/script HTTP requets (#30497) --- mellon/middleware.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mellon/middleware.py b/mellon/middleware.py index bd9e82b..2695d26 100644 --- a/mellon/middleware.py +++ b/mellon/middleware.py @@ -37,6 +37,9 @@ class PassiveAuthenticationMiddleware(object): # Skip AJAX requests if request.is_ajax(): return + # Skip AJAX and media/script requests, unless mellon_no_passive is False on the view + if getattr(view_func, 'mellon_no_passive', True) and 'text/html' not in request.META.get('HTTP_ACCEPT', ''): + return # Skip views asking to be skiped if getattr(view_func, 'mellon_no_passive', False): return -- 2.23.0