cleaned up a little remove the ViewDecoratorMiddleware

This commit is contained in:
Ken Cochrane 2015-01-25 22:48:02 -05:00
parent 10d6b50f09
commit 333fb2d8ec
4 changed files with 0 additions and 22 deletions

View file

@ -278,8 +278,6 @@ locked out.
* ``DEFENDER_REDIS_URL``: String: the redis url for defender.
Default: ``redis://localhost:6379/0``
(Example with password: ``redis://:mypassword@localhost:6379/0``)
* ``DEFENDER_PROTECTED_LOGINS``: Tuple: Used by ``ViewDecoratorMiddleware`` to decide
which login urls need protecting. Default: ``('/accounts/login/',)``
* ``DEFENDER_USE_CELERY``: Boolean: If you want to use Celery to store the login
attempt to the database, set to True. If False, it is saved inline.
Default: ``False``

View file

@ -1,7 +1,6 @@
from django.contrib.auth import views as auth_views
from .decorators import watch_login
from .config import PROTECTED_LOGINS
class FailedLoginMiddleware(object):
@ -10,20 +9,3 @@ class FailedLoginMiddleware(object):
# watch the auth login
auth_views.login = watch_login(auth_views.login)
class ViewDecoratorMiddleware(object):
"""
When the django_axes middleware is installed, by default it watches the
django.auth.views.login.
This middleware allows adding protection to other views without the need
to change any urls or dectorate them manually.
Add this middleware to your MIDDLEWARE settings after
`defender.middleware.FailedLoginMiddleware` and before the django
flatpages middleware.
"""
def process_view(self, request, view_func, view_args, view_kwargs):
if request.path in PROTECTED_LOGINS:
return watch_login(view_func)(request, *view_args, **view_kwargs)
return None

View file

@ -15,7 +15,6 @@ MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'defender.middleware.FailedLoginMiddleware',
'defender.middleware.ViewDecoratorMiddleware',
)
ROOT_URLCONF = 'defender.test_urls'

View file

@ -15,7 +15,6 @@ MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'defender.middleware.FailedLoginMiddleware',
'defender.middleware.ViewDecoratorMiddleware',
)
ROOT_URLCONF = 'defender.test_urls'