Add password protected pages
This commit is contained in:
parent
c40cf14ce6
commit
f7d10df3d2
3 changed files with 36 additions and 10 deletions
|
@ -42,6 +42,7 @@ INSTALLED_APPS = [
|
||||||
'django.contrib.staticfiles',
|
'django.contrib.staticfiles',
|
||||||
|
|
||||||
'wagtailmetadata',
|
'wagtailmetadata',
|
||||||
|
'bootstrapform',
|
||||||
|
|
||||||
'project.blog',
|
'project.blog',
|
||||||
'project.common',
|
'project.common',
|
||||||
|
@ -166,14 +167,5 @@ WAGTAILSEARCH_BACKENDS = {
|
||||||
BASE_URL = 'https://theorangeone.net'
|
BASE_URL = 'https://theorangeone.net'
|
||||||
SITE_URL = BASE_URL
|
SITE_URL = BASE_URL
|
||||||
|
|
||||||
|
PASSWORD_REQUIRED_TEMPLATE = 'pages/password_required.html'
|
||||||
|
|
||||||
# Password policy settings
|
|
||||||
SESSION_SERIALIZER = 'django.contrib.sessions.serializers.PickleSerializer'
|
|
||||||
PASSWORD_CHECK_ONLY_AT_LOGIN = True
|
|
||||||
PASSWORD_MIN_LENGTH = 7
|
|
||||||
PASSWORD_MAX_LENGTH = 25
|
|
||||||
PASSWORD_HISTORY_COUNT = 6
|
|
||||||
PASSWORD_MIN_LETTERS = 1
|
|
||||||
PASSWORD_MIN_NUMBERS = 1
|
|
||||||
PASSWORD_MIN_SYMBOLS = 1
|
|
||||||
PASSWORD_DIFFERENCE_DISTANCE = 3
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ bleach==1.5
|
||||||
coverage==4.2
|
coverage==4.2
|
||||||
dj_database_url==0.4.1
|
dj_database_url==0.4.1
|
||||||
Django>=1.10,<1.11
|
Django>=1.10,<1.11
|
||||||
|
django-bootstrap-form==3.2.1
|
||||||
flake8==3.2.1
|
flake8==3.2.1
|
||||||
honcho==0.7.1
|
honcho==0.7.1
|
||||||
psycopg2==2.6.2
|
psycopg2==2.6.2
|
||||||
|
|
33
templates/pages/password_required.html
Normal file
33
templates/pages/password_required.html
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
{% extends "base.html" %}
|
||||||
|
|
||||||
|
{% load wagtailcore_tags bootstrap %}
|
||||||
|
|
||||||
|
{% block body_class %}template-passwordrequied{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<section class="bg-primary">
|
||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-8 col-lg-offset-2 text-center">
|
||||||
|
<h1 class="section-heading">Authentication Required</h1>
|
||||||
|
<hr class="light">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<div class="col-sm-4 col-sm-offset-4 text-center">
|
||||||
|
<h1>
|
||||||
|
<i class="fa fa-lock fa-5x"></i>
|
||||||
|
</h1>
|
||||||
|
<p>You need a password to access this page.</p>
|
||||||
|
<form action="{{ action_url }}" method="POST" role="form">
|
||||||
|
{% csrf_token %}
|
||||||
|
{{ form|bootstrap }}
|
||||||
|
<div class="form-group">
|
||||||
|
<button type="submit" class="btn btn-primary">Submit</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
{% endblock %}
|
Reference in a new issue