Skip to content

Commit

Permalink
Merge pull request #1797 from 18F/et-pentest-finding2
Browse files Browse the repository at this point in the history
Added NoCacheMiddleware
  • Loading branch information
edwintorres authored Sep 20, 2024
2 parents f4750d2 + 5149a81 commit 2f8010f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tock/tock/middleware.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from datetime import datetime, timedelta
from django.conf import settings
from django.contrib import auth
from django.utils.cache import add_never_cache_headers


class AutoLogout(object):
Expand Down Expand Up @@ -34,3 +35,13 @@ def __call__(self, request):
datetime.now().strftime(fmt)

return self.get_response(request)


class NoCacheMiddleware:
def __init__(self, get_response):
self.get_response = get_response

def __call__(self, request):
response = self.get_response(request)
add_never_cache_headers(response)
return response
1 change: 1 addition & 0 deletions tock/tock/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'tock.middleware.AutoLogout',
'tock.middleware.NoCacheMiddleware'
]

AUTHENTICATION_BACKENDS = (
Expand Down

0 comments on commit 2f8010f

Please sign in to comment.