Commit 1f4e0d88 authored by David Seaward's avatar David Seaward

* add STATICFILES_DIRS for generic files

* update registration templates to use latest Purist layouts
* update registration templates to use crispy forms
parent 130d88bf
......@@ -108,7 +108,7 @@ Contributions under the same terms are welcome.
Also includes code portions from:
* https://github.com/yourcelf/django-registration-defaults
(Copyright 2010 Charlie DeTar, Expat/MIT)
* https://github.com/RatanShreshtha/django-registration-templates
(Copyright 2015 Anders Hofstee and contributors, Expat/MIT)
* https://github.com/asyd/pyldap_orm/blob/master/pyldap_orm/controls.py
(Copyright 2016 Bruno Bonfils, Apache 2.0)
......@@ -3,7 +3,7 @@
# note that % must be escaped as %%
DEBUG=True
ALLOWED_HOSTS=localhost
STATIC_ROOT=/var/opt/purist_account/static
STATIC_ROOT = /var/opt/purist/account/static
REGISTRATION_OPEN=True
REG_PERSON_BASE_DN=ou=people,dc=example,dc=com
REG_PERSON_OBJECT_CLASSES=inetOrgPerson,organizationalPerson,person
......@@ -13,4 +13,5 @@ AUTH_LDAP_SERVER_URI=ldap://ldap.example.com
AUTH_LDAP_START_TLS=True
AUTH_LDAP_BIND_DN=cn=admin,dc=example,dc=com
AUTH_LDAP_USER_SEARCH_BASE_DN=ou=people,dc=example,dc=com
SQLITE_DB_PATH=/var/opt/purist_account/db.sqlite3
SQLITE_DB_PATH = /var/opt/purist/account/db.sqlite3
STATICFILES_DIRS = /var/opt/purist/brand
<!DOCTYPE html>
<html lang="en">
<head>
<!-- load static from static files -->
<meta charset="UTF-8">
<title>Puri.st services</title>
<link rel="stylesheet" href="{% static 'PuristFlex.css' %}"/>
<title>Purist - Easy, secure communication for everyone</title>
<link rel="icon" sizes="960x960" href="{% static 'favicon.png' %}">
<meta name="application-name" content="Purist">
</head>
<body>
<h1>Puri.st services</h1>
<body style="text-align: center">
{% if username %}
<p>
<p style="text-align: right">
You are logged in as {{username}}.<br />
<a href="/accounts/logout/">Log out</a>
</p>
{% else %}
<p>
<p style="text-align: right">
You are not logged in.<br />
<a href="/accounts/login/">Log in</a> or <a href="/accounts/register/">register</a>.
</p>
{% endif %}
<p>
<a href="/admin/">Admin</a>
</p>
<h1><img style="max-height: 30%; max-width: 50%" src="{% static 'logo.png' %}" alt="Purist"/></h1>
<p>Easy, secure communication for everyone</p>
<p><a href="https://plan.puri.st">plan</a> | <a href="https://code.puri.sm/purist">code</a> | <a
href="http://dev.comms.puri.st:8000">test</a> | <a href="/admin/">admin</a></p>
<p style="font-size: small">Services provided by <a href="https://puri.sm">Purism SPC</a>. Stand-in logo from <a
href="https://openclipart.org/detail/158443/kawaii-rainbow">Openclipart</a> [CC0].</p>
</body>
</html>
<!DOCTYPE html>
{% load i18n %} {% load static %}
<!-- Content, copyright 2017 Purism SPC and contributors -->
<!-- https://plan.puri.st/app/account_web -->
<!-- SPDX-License-Identifier: CC-BY-SA-4.0 -->
<!-- Original registration template, copyright 2015 Anders Hofstee and contributors -->
<!-- https://github.com/RatanShreshtha/django-registration-templates -->
<!-- SPDX-License-Identifier: MIT -->
<html lang="en">
<head>
<meta charset="UTF-8">
<title>{% block title %}{% endblock %}</title>
<link rel="stylesheet" href="{% static 'PuristFlex.css' %}"/>
<title>{% block title %}Base{% endblock %}</title>
<link rel="icon" sizes="960x960" href="{% static 'favicon.png' %}">
<meta name="application-name" content="Purist">
</head>
<body>
{% block content %}{% endblock %}
<header>
<a href="{% url 'home_page' %}"><img class="logo" src="{% static 'logo.png' %}" alt="Purist"/></a>
<div>
<h1>{% block header %}Base{% endblock %}</h1>
<!-- p></p -->
<p>
{% block byline %}Byline{% endblock %} |
{% if user.is_authenticated %}
{% trans "Logged in" %}: {{ user.username }}
(<a href="{% url 'auth_logout' %}">{% trans "Log out" %}</a> |
<a href="{% url 'auth_password_change' %}">{% trans "Change password" %}</a>)
{% else %}
<a href="{% url 'auth_login' %}">{% trans "Log in" %}</a>
{% endif %}
</p>
</div>
</header>
<div id="main">
<article>
{% block content %}{% endblock %}
</article>
</div>
</body>
</html>
{# The following code adapted from https://github.com/yourcelf/django-registration-defaults Copyright 2010 Charlie DeTar SPDX-License-Identifier: MIT (aka Expat) #}
{% extends "base.html" %} {% load i18n %} {% load crispy_forms_tags %}
{% extends "base.html" %}
{% load i18n %}
{% block title %}{% trans "Login" %}{% endblock %}
{% block content %}
{% url 'auth_password_reset' as auth_pwd_reset_url %}
{% url 'registration_register' as register_url%}
{% block title %}{% trans 'Log in' %}{% endblock %}
{% block header %}{% trans 'Log in' %}{% endblock %}
{% block byline %}{% trans 'Please fill in your credentials' %}{% endblock %}
{% if form.errors %}
<p>{% blocktrans %}Your username and password didn't match. Please try again.{% endblocktrans %}</p>
{% endif %}
{% block content %}
<br/>
<form method="post" action="{% url 'auth_login' %}">{% csrf_token %}
<table>
<tr>
<td>{% trans form.username.label_tag %}</td>
<td>{{ form.username }}</td>
</tr>
<tr>
<td>{% trans form.password.label_tag %}</td>
<td>{{ form.password }}</td>
</tr>
</table>
<p>{% blocktrans %}<a href="{{ register_url }}">Need an account</a>?{% endblocktrans %}</p>
<!-- Main Content -->
<main class="container">
<section class="row">
<section class="col-lg-4 col-lg-offset-4 col-md-4 col-md-offset-5">
<form method="post" action=".">
{% csrf_token %} {{ form|crispy}}
<input type="submit" value="{% trans 'login' %}" />
<input type="hidden" name="next" value="{{ next }}" />
</form>
<input type="submit" value="{% trans 'Log in' %}"/>
<input type="hidden" name="next" value="{{ next }}"/>
</form>
</section>
</section>
</main>
<p class="text-center">{% trans "No account yet?" %} <a href="{% url 'registration_register' %}">{% trans "Register!"
%}</a></p>
{% endblock %}
{# The following code adapted from https://github.com/yourcelf/django-registration-defaults Copyright 2010 Charlie DeTar SPDX-License-Identifier: MIT (aka Expat) #}
{% extends "base.html" %}
{% load i18n %}
{% block title %}{% trans "Logged out" %}{% endblock %}
{% load crispy_forms_tags %}
{% block title %}{% trans 'Log out' %}{% endblock %}
{% block header %}{% trans 'Log out' %}{% endblock %}
{% block byline %}{% endblock %}
{% block content %}
{% trans "Successfully logged out!" %}<br />
<a href="/">Home</a>
<br/>
<p>{% trans "You have been logged out" %}</p>
{% endblock %}
{# The following code adapted from https://github.com/yourcelf/django-registration-defaults Copyright 2010 Charlie DeTar SPDX-License-Identifier: MIT (aka Expat) #}
{% extends "base.html" %} {% load i18n %} {% load crispy_forms_tags %}
{% block title %}{% trans 'Register' %}{% endblock %}
{% block header %}{% trans 'Register' %}{% endblock %}
{% block byline %}{% trans 'Please fill in your registration details' %}{% endblock %}
{% extends "base.html" %}
{% load i18n %}
{% block title %}{% trans "Register for an account" %}{% endblock %}
{% block content %}
<table>
<form method='post' action=''>{% csrf_token %}
{{ form }}
<tr><td></td><td><input type="submit" value="{% trans 'Register' %}" /></td></tr>
</form>
</table>
<br/>
<!-- Main Content -->
<main class="container">
<section class="row">
<section class="col-lg-4 col-lg-offset-4 col-md-4 col-md-offset-5">
<form method="post" action=".">
{% csrf_token %} {{ form|crispy}}
<input type="submit" value="{% trans 'Submit' %}"/>
</form>
</section>
</section>
</main>
{% endblock %}
from .settings_original import *
# from registration_defaults.settings import *
import ldap
from django_auth_ldap.config import LDAPSearch
from decouple import Config, Csv, RepositoryIni
from django_auth_ldap.config import LDAPSearch
from .settings_original import *
#
# LOAD CONFIGURATION FILE
......@@ -32,7 +33,7 @@ ALLOWED_HOSTS = config("ALLOWED_HOSTS", cast=Csv())
#
# INSTALLED_APPS = ["registration_defaults", ] + INSTALLED_APPS + ["ldapregister", ]
INSTALLED_APPS += ["ldapregister", ]
INSTALLED_APPS += ["crispy_forms", "ldapregister", ]
REGISTRATION_OPEN = config("REGISTRATION_OPEN", cast=bool)
......@@ -93,3 +94,5 @@ DATABASES = {
DATABASE_ROUTERS = ['ldapdb.router.Router']
STATIC_ROOT = config("STATIC_ROOT")
STATICFILES_DIRS = config("STATICFILES_DIRS", cast=Csv())
Django==1.11.2
django-auth-ldap==1.2.12
django-crispy-forms==1.6.1
django-ldapdb==0.9.0
django-registration==2.2
Jinja2==2.9.6
......@@ -7,4 +8,3 @@ jinja2-django-tags==0.5
pyasn1==0.2.3
python-decouple==3.0
dj-database-url==0.4.2
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment