1
Fork 0

Add password protected pages

This commit is contained in:
Jake Howard 2016-12-17 22:22:16 +00:00
parent c40cf14ce6
commit f7d10df3d2
3 changed files with 36 additions and 10 deletions

View file

@ -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

View file

@ -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

View 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 %}