diff --git a/debian/control b/debian/control index d398152a9..4b3ba3e0b 100644 --- a/debian/control +++ b/debian/control @@ -28,7 +28,7 @@ Build-Depends: debhelper (>= 10~) , python3-django (>= 1.11) , python3-django-axes (>= 3.0.3) , python3-django-captcha - , python3-django-stronghold + , python3-django-stronghold (>= 0.3.0) , python3-gi , python3-psutil , python3-requests diff --git a/plinth/__main__.py b/plinth/__main__.py index 15d4ceaa3..380d206d6 100644 --- a/plinth/__main__.py +++ b/plinth/__main__.py @@ -277,7 +277,7 @@ def configure_django(): LOGIN_URL='users:login', LOGIN_REDIRECT_URL='index', MESSAGE_TAGS={message_constants.ERROR: 'danger'}, - MIDDLEWARE_CLASSES=( + MIDDLEWARE=( 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.locale.LocaleMiddleware', diff --git a/plinth/middleware.py b/plinth/middleware.py index ac8d6f710..877749b86 100644 --- a/plinth/middleware.py +++ b/plinth/middleware.py @@ -24,6 +24,7 @@ from django.contrib import messages from django.contrib.auth.decorators import login_required from django.core.exceptions import PermissionDenied from django.shortcuts import render +from django.utils.deprecation import MiddlewareMixin from django.utils.translation import ugettext_lazy as _ import logging @@ -38,7 +39,7 @@ from . import views logger = logging.getLogger(__name__) -class SetupMiddleware(object): +class SetupMiddleware(MiddlewareMixin): """Django middleware to show pre-setup message and setup progress.""" @staticmethod @@ -92,7 +93,7 @@ class SetupMiddleware(object): return view(request, setup_helper=module.setup_helper) -class AdminRequiredMiddleware(object): +class AdminRequiredMiddleware(MiddlewareMixin): """Django middleware for authenticating requests for admin areas.""" @staticmethod @@ -106,7 +107,7 @@ class AdminRequiredMiddleware(object): raise PermissionDenied -class FirstSetupMiddleware(object): +class FirstSetupMiddleware(MiddlewareMixin): """Django middleware to block all interactions before first setup.""" @staticmethod diff --git a/plinth/modules/first_boot/middleware.py b/plinth/modules/first_boot/middleware.py index 8735e7596..914079afb 100644 --- a/plinth/modules/first_boot/middleware.py +++ b/plinth/modules/first_boot/middleware.py @@ -20,17 +20,19 @@ Django middleware to redirect to firstboot wizard if it has not be run yet. """ +import logging + +from django.conf import settings from django.http.response import HttpResponseRedirect from django.urls import reverse -from django.conf import settings -import logging +from django.utils.deprecation import MiddlewareMixin from plinth.modules import first_boot LOGGER = logging.getLogger(__name__) -class FirstBootMiddleware(object): +class FirstBootMiddleware(MiddlewareMixin): """Forward to firstboot page if firstboot isn't finished yet.""" @staticmethod diff --git a/setup.py b/setup.py index 8f1697ec7..525fb1e37 100755 --- a/setup.py +++ b/setup.py @@ -212,7 +212,7 @@ setuptools.setup( 'django >= 1.11.0', 'django-bootstrap-form', 'django-simple-captcha', - 'django-stronghold', + 'django-stronghold >= 0.3.0', 'psutil', 'python-apt', 'python-augeas',