middleware: skip media/script HTTP requets (#30497)

This commit is contained in:
Benjamin Dauvergne 2019-10-01 00:47:49 +02:00
parent 555a251a0c
commit 42620b50a9
1 changed files with 3 additions and 0 deletions

View File

@ -37,6 +37,9 @@ class PassiveAuthenticationMiddleware(MiddlewareClass):
# 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