Add axes support with custom error page
This commit is contained in:
parent
9b56787057
commit
395e03803f
|
@ -126,3 +126,7 @@ def post_location(request):
|
|||
form = LocationForm ()
|
||||
|
||||
return render(request, 'borg/post/location.html', {'form': form})
|
||||
|
||||
|
||||
def axes(request, credentials, *args, **kwargs):
|
||||
return render(request, 'error/axes.html', {})
|
||||
|
|
|
@ -22,9 +22,15 @@ DEBUG = True
|
|||
|
||||
ALLOWED_HOSTS = []
|
||||
|
||||
AXES_LOCKOUT_CALLABLE = "borg.views.axes"
|
||||
|
||||
# Application definition
|
||||
|
||||
AUTHENTICATION_BACKENDS = [
|
||||
'axes.backends.AxesBackend',
|
||||
'django.contrib.auth.backends.ModelBackend',
|
||||
]
|
||||
|
||||
INSTALLED_APPS = [
|
||||
'borg.apps.BorgConfig',
|
||||
'django.contrib.admin',
|
||||
|
@ -34,6 +40,7 @@ INSTALLED_APPS = [
|
|||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
'compressor',
|
||||
'axes',
|
||||
]
|
||||
|
||||
MIDDLEWARE = [
|
||||
|
@ -44,6 +51,7 @@ MIDDLEWARE = [
|
|||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
'django.contrib.messages.middleware.MessageMiddleware',
|
||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||
'axes.middleware.AxesMiddleware',
|
||||
]
|
||||
|
||||
ROOT_URLCONF = 'borgweb.urls'
|
||||
|
|
|
@ -35,7 +35,7 @@ print_action "Installing pip packages, this may take a while..."
|
|||
|
||||
# install required pip packages
|
||||
yes | python -m pip install --upgrade wheel
|
||||
yes | python -m pip install django gunicorn sass django-libsass django_compressor
|
||||
yes | python -m pip install django gunicorn sass django-libsass django-compressor django-axes
|
||||
|
||||
print_action "Setting up static files and database"
|
||||
|
||||
|
|
4
borgweb/templates/error/axes.html
Normal file
4
borgweb/templates/error/axes.html
Normal file
|
@ -0,0 +1,4 @@
|
|||
{% extends "error/error.html" %}
|
||||
|
||||
{% block title %}Access Denied{% endblock %}
|
||||
{% block error_message %}Too many failed login attempts{% endblock %}
|
Loading…
Reference in New Issue
Block a user