From fc2f6c3f7184c1d88ae2921a08a3c36964966831 Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Tue, 10 Feb 2015 14:41:39 +0000 Subject: [PATCH] Add SessionAuthenticationMiddleware if available. This was added in Django 1.7 in order to invalidate sessions on password change. --- project/settings.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/project/settings.py b/project/settings.py index 62a3428e..3ba4d433 100644 --- a/project/settings.py +++ b/project/settings.py @@ -165,7 +165,7 @@ # similar ETag code in CommonMiddleware. USE_ETAGS = False -MIDDLEWARE_CLASSES = ( +MIDDLEWARE_CLASSES = [ 'mapit.middleware.gzip.GZipMiddleware', # Not 'django.middleware.gzip.GZipMiddleware' to work around Django #24242 'django.middleware.http.ConditionalGetMiddleware', @@ -177,7 +177,9 @@ 'django.middleware.cache.FetchFromCacheMiddleware', 'mapit.middleware.JSONPMiddleware', 'mapit.middleware.ViewExceptionMiddleware', -) +] +if django.get_version() >= '1.7': + MIDDLEWARE_CLASSES.append('django.contrib.auth.middleware.SessionAuthenticationMiddleware') ROOT_URLCONF = 'project.urls'