Add registration and login templates plus UI stuff, moderation

This commit is contained in:
Livvy Mackintosh
2017-10-08 21:21:51 +01:00
parent f8dc44b4a6
commit 049ca29e77
64 changed files with 18607 additions and 159 deletions

View File

@ -35,12 +35,18 @@ ALLOWED_HOSTS = os.getenv('ALLOWED_HOSTS', 'localhost').split()
# Application definition
INSTALLED_APPS = [
'apps.contact',
'apps.map',
'apps.profiles',
'django.contrib.admin',
'registration',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.humanize',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'whitenoise.runserver_nostatic',
'django.contrib.staticfiles',
'django.contrib.gis',
'bootstrap3',
@ -48,13 +54,16 @@ INSTALLED_APPS = [
'compressor',
'crispy_forms',
'django_extensions',
'envelope',
'leaflet',
'moderation',
'rest_framework',
'rest_framework_gis',
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'whitenoise.middleware.WhiteNoiseMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.middleware.common.CommonMiddleware',
@ -66,10 +75,12 @@ MIDDLEWARE = [
ROOT_URLCONF = 'ojusomap.urls'
SITE_ID = 1
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'DIRS': [os.path.join(BASE_DIR, 'ojusomap/templates/')],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
@ -95,7 +106,6 @@ EMAIL_HOST_USER = os.getenv('EMAIL_HOST_USER')
EMAIL_PORT = os.getenv('EMAIL_PORT', 25)
EMAIL_USE_TLS = bool(int(os.getenv('EMAIL_USE_TLS', False)))
EMAIL_SUBJECT_PREFIX = "Ojuso Platform"
SERVER_EMAIL = os.getenv('SERVER_EMAIL', 'root@localhost')
@ -131,6 +141,8 @@ AUTH_PASSWORD_VALIDATORS = [
},
]
# Registration (Redux)
ACCOUNT_ACTIVATION_DAYS = 3
# Internationalization
# https://docs.djangoproject.com/en/1.11/topics/i18n/
@ -163,10 +175,9 @@ STATIC_URL = os.getenv("STATIC_URL", '/static/')
STATICFILES_FINDERS = [
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
'compressor.finders.CompressorFinder',
]
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
# Cache
# https://docs.djangoproject.com/en/1.11/topics/cache/
@ -204,7 +215,7 @@ REST_FRAMEWORK = {
# Django Crispy Forms
# http://django-crispy-forms.readthedocs.io/en/latest/
CRISPY_TEMPLATE_PACK = 'bootstrap3'
CRISPY_TEMPLATE_PACK = 'bootstrap4'
# Django-Leaflet
# https://django-leaflet.readthedocs.io/en/latest/

View File

@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
</body>
</html>

View File

@ -0,0 +1,9 @@
{% extends 'base_page.html' %}
{% block title %}
Shucks.
{% endblock %}
{% block description %}
Looks like you're not supposed to be here.
{% endblock %}

View File

@ -0,0 +1,9 @@
{% extends 'base_page.html' %}
{% block title %}
Shucks.
{% endblock %}
{% block description %}
You've taken a wrong turn and we can't find the page you're looking for.
{% endblock %}

View File

@ -0,0 +1,9 @@
{% extends 'base_page.html' %}
{% block title %}
Shucks.
{% endblock %}
{% block description %}
An unknown server error occurred. Sorry about that.
{% endblock %}

View File

@ -0,0 +1,66 @@
{% spaceless %}
{% load i18n %}
{% load leaflet_tags %}
{% load static %}
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<title>{% block page_title %}Ojuso{% endblock %}</title>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<script src="{% static 'map/bundle.js'%}"></script>
{# Additional Stylesheets #}
{% block stylesheets %}
<style>
.navbar-brand {padding: 5px 15px;}
.navbar-brand > img {height: 40px;}
</style>
{% endblock %}
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<a class="navbar-brand" href="{% url 'index' %}">
<img src="{% static 'map/images/ojuso-logo-black.png' %}" height="40px"/>
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav">
<li class="nav-item active">
<a class="nav-link" href="#">Map <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Policy</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Contact</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">FAQ</a>
</li>
</ul>
</div>
{% if user.is_authenticated %}
<span>{{user}}</span>
<a class="btn btn-primary" href={% url 'auth_logout' %}>Logout</a>
{% else %}
<a style="margin: 5px;" class="btn btn-primary" href={% url 'auth_login' %}>Login</a>
<a style="margin: 5px;" class="btn btn-info" href={% url 'registration_register' %}>Register</a>
{% endif %}
</nav>
{% block body %}{% endblock %}
</body>
{# CDN Javascript #}
<script src="//code.jquery.com/jquery-3.2.1.min.js"
integrity="sha384-xBuQ/xzmlsLoJpyjoggmTEz8OWUFM0/RC5BsqQBDX2v5cMvDHcMakNTNrHIW2I5f"
crossorigin="anonymous">
</script>
{% block scripts %}{% endblock %}
</html>
{% endspaceless %}

View File

@ -0,0 +1,27 @@
{% extends "base.html" %}
{% block stylesheets %}
{{ block.super }}
<style>
.page-lead {
padding: 40px 15px;
text-align: center;
}
</style>
{% endblock %}
{% block body %}
<div class="container">
<div class="page-lead">
<h1 class="text-center">{% block title %}{% endblock %}</h1>
<p class="lead text-center">{% block description %}{% endblock %}</p>
</div>
{% block content %}
{% endblock %}
</div><!-- /.container -->
{% endblock %}

View File

@ -0,0 +1,25 @@
{% extends "base.html" %}
{% block stylesheets %}
{{ block.super }}
<style>
.jumbo {
height: calc(100% - 64px);
width: 100%;
position: absolute;
right: 0;
bottom: 0;
left: 0;
}
</style>
{% endblock %}
{% block body %}
<div class="jumbo">
{% block content %}
{% endblock %}
</div><!-- /.container -->
{% endblock %}

View File

@ -0,0 +1 @@
{% extends 'base_page.html' %}

View File

@ -0,0 +1 @@
{% extends 'base_page.html' %}

View File

@ -0,0 +1,10 @@
{% extends 'base_email.html' %}
{% block content %}
<div align="left">
{{user}},<br><br>
To activate your account and log in, <a href="https://animalrightsmap.org{% url 'registration_activate' activation_key %}">click here</a>.<br>
This link will expire in 7 days so be sure do it soon.<br><br>
See you on the activist trail!<br><br>
- Animal Rights Map
</div>
{% endblock %}

View File

@ -0,0 +1 @@
Activate your Ojuso Identity account.

View File

@ -0,0 +1,24 @@
{% extends "base_page.html" %}
{% load bootstrap3 %}
{% load crispy_forms_tags %}
{% load envelope_tags %}
{% load i18n %}
{% block page_title %}{% trans "Login"%} | Ojuso{% endblock %}
{% block content %}
<div class="container" style="max-width:520px;">
<div class="page-lead">
<h2>Login</h2>
<p class="lead">{% trans "Welcome!" %}</p>
</div>
{% bootstrap_messages %}
<form action="{% url 'auth_login' %}" method="post">
{% csrf_token %}
{% antispam_fields %}
{{form|crispy}}
<p><a href="{% url 'auth_password_reset' %}">{% trans "Lost password?" %}</a></p>
<input class="btn btn-success pull-right" type="submit" name="submit" value="{% trans 'Login' %}"/>
</form>
</div>
{% endblock %}

View File

@ -0,0 +1,11 @@
{% extends "base_page.html" %}
{% load bootstrap3 %}
{% load crispy_forms_tags %}
{% load envelope_tags %}
{% load i18n %}
{% block page_name %}Registration{% endblock %}
{% block content %}
<p class="text-center">{% trans "You've just been logged out." %} <a href="{% url 'auth_login' %}">{% trans "Click here to login again." %}</p>
{% endblock %}

View File

@ -0,0 +1,14 @@
{% load i18n %}{% autoescape off %}
{% blocktrans %}You're receiving this email because you requested a password reset for your user account at {{ site_name }}.{% endblocktrans %}
{% trans "Please go to the following page and choose a new password:" %}
{% block reset_link %}
{{ protocol }}://{{ domain }}{% url 'auth_password_reset_confirm' uidb64=uid token=token %}
{% endblock %}
{% trans "Your username, in case you've forgotten:" %} {{ user.get_username }}
{% trans "Thanks for using our site!" %}
{% blocktrans %}The {{ site_name }} team{% endblocktrans %}
{% endautoescape %}

View File

@ -0,0 +1,12 @@
{% extends "base_page.html" %}
{% load bootstrap3 %}
{% block page_name %}Registration{% endblock %}
{% block content %}
<div class="container">
<div class="page-lead">
<h2>Registration</h2>
<p class="lead">Account registration is currently closed. Come back soon!</p>
</div>
</div>
{% endblock %}

View File

@ -0,0 +1,22 @@
{% extends "base_page.html" %}
{% load bootstrap3 %}
{% load crispy_forms_tags %}
{% load envelope_tags %}
{% block page_name %}Registration{% endblock %}
{% block content %}
<div class="container" style="max-width:520px;">
<div class="page-lead">
<h2>Registration</h2>
<p class="lead">Create your account and get active!</p>
</div>
{% bootstrap_messages %}
<form action="{% url 'registration_register' %}" method="post">
{% csrf_token %}
{% antispam_fields %}
{{ form|crispy }}
<input class="btn btn-success pull-right" type="submit" name"submit" value"Register"/>
</form>
</div>
{% endblock %}

View File

@ -14,6 +14,7 @@ Including another URLconf
2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls'))
"""
from django.conf.urls import include, url
from django.urls import reverse
from django.conf.urls.i18n import i18n_patterns
from django.contrib import admin
from django.contrib.auth.models import User
@ -51,8 +52,12 @@ urlpatterns = [
url(r'api/', include(apirouter.urls)),
url(r'^admin/', admin.site.urls),
url(r'^cas/', include('cas_server.urls', namespace='cas_server')),
# url(r'^contact/', include('apps.contact.urls'), name="contact")
]
urlpatterns += i18n_patterns(
url(r'^accounts/profile/', include('apps.profiles.urls')),
# url(r'^accounts/logout/?$', include('django.contrib.auth.views.logout'), {'next_page': '/'}),
url(r'^accounts/', include('registration.backends.default.urls')),
url(r'', include('apps.map.urls'), name="map"),
)