Log when SafeSessionMiddleware deletes cookies

This commit is contained in:
David Ormsbee
2019-02-22 16:35:27 -05:00
parent 61923a7369
commit fc52fcccab

View File

@@ -333,7 +333,7 @@ class SafeSessionMiddleware(SessionMiddleware):
_mark_cookie_for_deletion(request) _mark_cookie_for_deletion(request)
if _is_cookie_marked_for_deletion(request): if _is_cookie_marked_for_deletion(request):
_delete_cookie(response) # Step 4 _delete_cookie(request, response) # Step 4
return response return response
@@ -454,11 +454,15 @@ def _is_cookie_present(response):
) )
def _delete_cookie(response): def _delete_cookie(request, response):
""" """
Delete the cookie by setting the expiration to a date in the past, Delete the cookie by setting the expiration to a date in the past,
while maintaining the domain, secure, and httponly settings. while maintaining the domain, secure, and httponly settings.
""" """
log.warning(
u"SafeCookieData is deleting session cookie for user %d",
request.user.id
)
response.set_cookie( response.set_cookie(
settings.SESSION_COOKIE_NAME, settings.SESSION_COOKIE_NAME,
max_age=0, max_age=0,