Set up authentication system

This commit is contained in:
tjp03u
2014-10-23 22:13:03 +01:00
parent e10021d47b
commit c2beb24487
42 changed files with 705 additions and 1 deletions

1
.idea/.name generated Normal file
View File

@@ -0,0 +1 @@
PyRIGS

26
.idea/PyRIGS.iml generated Normal file
View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="FacetManager">
<facet type="django" name="Django">
<configuration>
<option name="rootFolder" value="$MODULE_DIR$" />
<option name="settingsModule" value="PyRIGS/settings.py" />
<option name="manageScript" value="manage.py" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="TemplatesService">
<option name="TEMPLATE_CONFIGURATION" value="Django" />
<option name="TEMPLATE_FOLDERS">
<list>
<option value="C:\Users\psytp\PycharmProjects\PyRIGS\templates" />
</list>
</option>
</component>
</module>

6
.idea/dataSources.ids generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<component name="dataSourceStorage">
<data-source source="LOCAL" name="Django default" uuid="09730cb6-cd27-4034-9959-d242e7905a51">
<database-info product="" version="" jdbc-version="" driver-name="" driver-version=""/>
</data-source>
</component>

12
.idea/dataSources.xml generated Normal file
View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DataSourceManagerImpl" format="xml" hash="3382254696">
<data-source source="LOCAL" name="Django default" uuid="09730cb6-cd27-4034-9959-d242e7905a51">
<driver-ref>sqlite.xerial</driver-ref>
<jdbc-driver>org.sqlite.JDBC</jdbc-driver>
<jdbc-url>jdbc:sqlite:C:\Users\psytp\PycharmProjects\PyRIGS\db.sqlite3</jdbc-url>
<libraries />
</data-source>
</component>
</project>

5
.idea/encodings.xml generated Normal file
View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
</project>

5
.idea/misc.xml generated Normal file
View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.4.2 virtualenv at C:\Users\psytp\PyRIGS" project-jdk-type="Python SDK" />
</project>

9
.idea/modules.xml generated Normal file
View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/PyRIGS.iml" filepath="$PROJECT_DIR$/.idea/PyRIGS.iml" />
</modules>
</component>
</project>

5
.idea/scopes/scope_settings.xml generated Normal file
View File

@@ -0,0 +1,5 @@
<component name="DependencyValidationManager">
<state>
<option name="SKIP_IMPORT_STATEMENTS" value="false" />
</state>
</component>

7
.idea/vcs.xml generated Normal file
View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

View File

@@ -37,6 +37,9 @@ INSTALLED_APPS = (
'django.contrib.messages', 'django.contrib.messages',
'django.contrib.staticfiles', 'django.contrib.staticfiles',
'RIGS', 'RIGS',
'registration',
'widget_tweaks',
) )
MIDDLEWARE_CLASSES = ( MIDDLEWARE_CLASSES = (
@@ -64,10 +67,26 @@ DATABASES = {
} }
} }
# User system
AUTH_USER_MODEL = 'RIGS.Profile'
LOGIN_REDIRECT_URL = '/'
LOGIN_URL = '/user/login'
LOGOUT_URL = '/user/logout'
ACCOUNT_ACTIVATION_DAYS = 7
# Email
EMAIL_TEST = False
if not DEBUG or EMAIL_TEST:
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
else:
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
# Internationalization # Internationalization
# https://docs.djangoproject.com/en/1.7/topics/i18n/ # https://docs.djangoproject.com/en/1.7/topics/i18n/
LANGUAGE_CODE = 'en-us' LANGUAGE_CODE = 'en-gb'
TIME_ZONE = 'UTC' TIME_ZONE = 'UTC'

View File

@@ -6,5 +6,9 @@ urlpatterns = patterns('',
# url(r'^$', 'PyRIGS.views.home', name='home'), # url(r'^$', 'PyRIGS.views.home', name='home'),
# url(r'^blog/', include('blog.urls')), # url(r'^blog/', include('blog.urls')),
url(r'^user/login$', 'RIGS.views.login', name='login'),
url('^user/', include('django.contrib.auth.urls')),
url('^user/', include('registration.backends.default.urls')),
url(r'^admin/', include(admin.site.urls)), url(r'^admin/', include(admin.site.urls)),
) )

View File

@@ -0,0 +1,42 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.core.validators
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('auth', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Profile',
fields=[
('id', models.AutoField(auto_created=True, verbose_name='ID', serialize=False, primary_key=True)),
('password', models.CharField(max_length=128, verbose_name='password')),
('last_login', models.DateTimeField(default=django.utils.timezone.now, verbose_name='last login')),
('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')),
('username', models.CharField(max_length=30, unique=True, help_text='Required. 30 characters or fewer. Letters, digits and @/./+/-/_ only.', verbose_name='username', validators=[django.core.validators.RegexValidator('^[\\w.@+-]+$', 'Enter a valid username.', 'invalid')])),
('first_name', models.CharField(max_length=30, blank=True, verbose_name='first name')),
('last_name', models.CharField(max_length=30, blank=True, verbose_name='last name')),
('email', models.EmailField(max_length=75, blank=True, verbose_name='email address')),
('is_staff', models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status')),
('is_active', models.BooleanField(default=True, help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active')),
('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')),
('initials', models.CharField(max_length=5, unique=True)),
('phone', models.CharField(max_length=13, blank=True, null=True)),
('groups', models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of his/her group.', verbose_name='groups', related_name='user_set', related_query_name='user', to='auth.Group')),
('user_permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', verbose_name='user permissions', related_name='user_set', related_query_name='user', to='auth.Permission')),
],
options={
'verbose_name_plural': 'users',
'verbose_name': 'user',
'abstract': False,
},
bases=(models.Model,),
),
]

View File

@@ -1,3 +1,16 @@
from django.db import models from django.db import models
from django.contrib.auth.models import AbstractUser
from django.conf import settings
import hashlib
# Create your models here. # Create your models here.
class Profile(AbstractUser):
initials = models.CharField(max_length=5, unique=True)
phone = models.CharField(max_length=13, null=True, blank=True)
@property
def profile_picture (self):
url = ""
if settings.USE_GRAVATAR or settings.USE_GRAVATAR is None:
url = "https://www.gravatar.com/avatar/" + hashlib.md5(self.email).hexdigest() + "?d=identicon&s=500"
return url

View File

@@ -1,3 +1,11 @@
from django.shortcuts import render from django.shortcuts import render
from django.http.response import HttpResponseRedirect
# Create your views here. # Create your views here.
def login(request, **kwargs):
if request.user.is_authenticated():
next = request.REQUEST.get('next', '/')
return HttpResponseRedirect(request.REQUEST.get('next', '/'))
else:
from django.contrib.auth.views import login
return login(request)

BIN
db.sqlite3 Normal file

Binary file not shown.

6
templates/404.html Normal file
View File

@@ -0,0 +1,6 @@
{% extends 'base.html' %}
{% block title %}Page not found{% endblock %}
{% block content %}
The page you requested could not be found.
{% endblock %}

6
templates/500.html Normal file
View File

@@ -0,0 +1,6 @@
{% extends 'base.html' %}
{% block title %}Server error{% endblock %}
{% block content %}
There was an error while handling your request.
{% endblock %}

138
templates/base.html Normal file
View File

@@ -0,0 +1,138 @@
{% load static from staticfiles %}
<!DOCTYPE html>
<html
dir="{% if LANGUAGE_BIDI %}rtl{% else %}ltr{% endif %}"
xml:lang="{% firstof LANGUAGE_CODE 'en' %}"
lang="{% firstof LANGUAGE_CODE 'en' %}">
<head>
<title>{% block title %}{% endblock %} | Rig Information Gathering System</title>
<meta name="viewport" content="initial-scale=1">
<link rel="stylesheet" type="text/css" href="{% static "css/screen.css" %}">
{% block css %}
{% endblock %}
{% block preload_js %}
{% endblock %}
{% block extra-head %}{% endblock %}
</head>
<body>
<div class="navbar navbar-fixed-top navbar-inverse hidden-print" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/">RIGS</a>
</div>
<div class="navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="/">Home</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Rigboard<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="#">Rigboard</a></li>
<li><a href="#">Calendar</a></li>
<li><a href="#">Bookings</a></li>
<li><a href="#">Other Events</a></li>
</ul>
</li>
{% if perms.RIGS.view_vatrate or perms.RIGS.view_invoice %}
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
Finance<b class="caret"></b>
</a>
<ul class="dropdown-menu">
{% if perms.RIGS.view_invoice %}
<li><a href="">Invoices</a></li>
{% endif %}
{% if perms.RIGS.view_vatrate %}
<li><a href="">VAT</a></li>
{% endif %}
</ul>
</li>
{% endif %}
</ul>
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
{% if user.is_authenticated %}
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<span class="glyphicon glyphicon-user"></span>
Hi {{ user.first_name }}
<b class="caret"></b>
</a>
<ul class="dropdown-menu nav media-list pull-right" id="userdropdown">
<li class="media">
<span class="pull-left">
<img src="{{ request.user.profile_picture }}" class="media-object" />
</span>
<div class="media-body">
<b>{{ request.user.first_name }} {{ request.user.last_name }}</b>
<p class="muted">{{ request.user.email }}</p>
</div>
</li>
<li>
<a href="{% url 'logout' %}" class="btn btn-primary pull-right">Logout</a>
</li>
</ul>
{% else %}
<a href="{% url 'login' %}?next={{ request.build_absolute_uri }}">
<span class="icon-user"></span>
Hi guest
</a>
{% endif %}
</li>
</ul>
</div>
</div>
</div>
<div class="container">
<div id="content" class="row">
{% block content-header %}
{% if error %}<div class="error">{{ error }}</div>{% endif %}
{% if info %}<div class="info">{{ info }}</div>{% endif %}
{% if messages %}
{% for message in messages %}
<div class="info">{{ message }}</div>
{% endfor %}
{% endif %}
{% endblock %}
{% block content %}{% endblock %}
</div>
<div id="sidebar" class="column">
{% block sidebar %}
{% endblock %}
</div>
</div>
<script src="//code.jquery.com/jquery-latest.min.js"></script>
<script>
Date.prototype.getISOString = function() {
var yyyy = this.getFullYear().toString();
var mm = (this.getMonth()+1).toString(); // getMonth() is zero-based
var dd = this.getDate().toString();
return yyyy + '-' + (mm[1]?mm:"0"+mm[0]) + '-' + (dd[1]?dd:"0"+dd[0]); // padding
};
</script>
<script src="{% static "js/jquery.cookie.js" %}"></script>
<script src="{% static "js/alert.js" %}"></script>
<script src="{% static "js/collapse.js" %}"></script>
<script>
$('.navbar-collapse').addClass('collapse')
</script>
<script src="{% static "js/dropdown.js" %}"></script>
{% block js %}
{% endblock %}
</body>
</html>

View File

@@ -0,0 +1,8 @@
{% if messages %}
{% for message in messages %}
<script>{{message|safe}}</script>
{% endfor %}
{% endif %}
<script>
$('.modal').modal('hide');
</script>

View File

@@ -0,0 +1,14 @@
{% load nice_errors from filters %}
{% if form.errors %}
<div class="alert alert-danger alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
<dl class="dl-horizontal">
{% with form|nice_errors as qq %}
{% for error_name,desc in qq.items %}
<dt>{{error_name}}</dt>
<dd>{{desc}}</dd>
{% endfor %}
{% endwith %}
</dl>
</div>
{% endif %}

27
templates/pagination.html Normal file
View File

@@ -0,0 +1,27 @@
{% if is_paginated %}
<div>
<ul class="pagination">
{% if page_obj.has_previous %}
<li><a href="?page{{ page_obj.previous_page_number }}{{ getvars }}{{ hashtag }}" class="prev">&lsaquo;&lsaquo;</a></li>
{% else %}
<li class="disabled prev"><a href="#">&lsaquo;&lsaquo;</a></li>
{% endif %}
{% for page in pages %}
{% if page %}
{% ifequal page page_obj.number %}
<li class="current page active"><a href="#">{{ page }}</a></li>
{% else %}
<li><a href="?page={{ page }}{{ getvars }}{{ hashtag }}" class="page">{{ page }}</a></li>
{% endifequal %}
{% else %}
...
{% endif %}
{% endfor %}
{% if page_obj.has_next %}
<li><a href="?page={{ page_obj.next_page_number }}{{ getvars }}{{ hashtag }}" class="next">&rsaquo;&rsaquo;</a></li>
{% else %}
<li class="disabled next"><a href="#">&rsaquo;&rsaquo;</a></li>
{% endif %}
</ul>
</div>
{% endif %}

View File

@@ -0,0 +1,12 @@
{% load url from future %}
Welcome {{ profile.first_name }},
You request to become a user on {{ site }} has been approved by an administrator.
To continue the registration process please visit http://{{ site.domain }}{% url 'registration_activate' activation_key=activation_key %}.
This link will be active for the next {{ expiration_days }} days.
{% if message %}
Message from administrator:
{{ message }}
{% endif %}

View File

@@ -0,0 +1 @@
{{ site }} user {{ user }} activation {{ activation_key }}

View File

@@ -0,0 +1,10 @@
{% extends 'base.html' %}
{% block title %}Activation Complete{% endblock %}
{% block content %}
<div class="alert alert-success">
<h2>Activation Complete</h2>
<p>You user account is now fully registered. Enjoy RIGS</p>
</div>
{% endblock %}

View File

@@ -0,0 +1,5 @@
Congratulations {{ user.first_name }}. You are now fully registered on {{ site }}.
{% if is_generated %}
You password for this site has been automatically set to {{ password }}. It is recommend you change this as soon as possible.
{% endif %}

View File

@@ -0,0 +1 @@
{{ user }} activation successful

View File

@@ -0,0 +1,17 @@
{% extends 'base.html' %}
{% load widget_tweaks %}
{% block title %}Activation{% endblock %}
{% block content %}
<form action="" method="post" class="form-horizontal" role="form">{% csrf_token %}
{% for field in form %}
<div class="form-group">
<label for="{{ field.id_for_label }}" class="control-label col-sm-2">{{ field.label }}</label>
<div class="controls col-sm-10">
{% render_field field class+="form-control" placeholder=field.label %}
</div>
</div>
{% endfor %}
<p><input type="submit" value="Activate Account" class="btn btn-primary pull-right"></p>
</form>
{% endblock %}

View File

@@ -0,0 +1,10 @@
{% extends 'base.html' %}
{% block title %}Logout Successful{% endblock %}
{% block content %}
<div class="alert alert-success">
<h2>Logout Successful</h2>
<p>You have successfully been logged out of RIGS</p>
</div>
{% endblock %}

View File

@@ -0,0 +1,7 @@
{% extends 'base.html' %}
{% block title %}Login{% endblock %}
{% block content %}
{% include 'registration/loginform.html' %}
{% endblock %}

View File

@@ -0,0 +1,22 @@
{% load url from future %}
{% load widget_tweaks %}
{% if form.errors %}
<div class="error">Your username or password was incorrect</div>
{% endif %}
<div class="col-md-4 col-md-offset-4">
<form action="{% url 'login' %}" method="post" role="form">{% csrf_token %}
<div class="form-group">
<label for="id_username">{{ form.username.label }}</label>
{% render_field form.username class+="form-control" placeholder=form.username.label %}
</div>
<div class="form-group">
<label for="{{ form.password.id_for_label }}">{{ form.password.label }}</label>
{% render_field form.password class+="form-control" placeholder=form.password.label %}
</div>
<a href="{% url 'registration_register' %}" class="btn">Register</a>
<a href="{% url 'password_reset' %}" class="btn">Forgotten Password</a>
<input type="submit" value="Login" class="btn btn-primary" />
<input type="hidden" name="next" value="{{next}}" />
</form>
</div>

View File

@@ -0,0 +1,3 @@
A new user has just registered on {{ site }} with username {{ user.username }} and email {{ user.email }}.
Please visit {{ site.domain }}{% url admin:registration_registrationprofile_change user.registration_profile.id %} to moderate this activation.

View File

@@ -0,0 +1 @@
{{ site }} New User Approval Require

View File

@@ -0,0 +1,56 @@
{% extends "admin/base_site.html" %}
{% load i18n static %}
{% load url from future %}
{% block extrastyle %}{{ block.super }}<link rel="stylesheet" type="text/css" href="{% static "admin/css/forms.css" %}" />{% endblock %}
{% block userlinks %}{% url 'django-admindocs-docroot' as docsroot %}{% if docsroot %}<a href="{{ docsroot }}">{% trans 'Documentation' %}</a> / {% endif %} {% trans 'Change password' %} / <a href="{% url 'admin:logout' %}">{% trans 'Log out' %}</a>{% endblock %}
{% block breadcrumbs %}
<div class="breadcrumbs">
<a href="{% url 'admin:index' %}">{% trans 'Home' %}</a>
&rsaquo; {% trans 'Password change' %}
</div>
{% endblock %}
{% block title %}{% trans 'Password change' %}{% endblock %}
{% block content %}<div id="content-main">
<form action="" method="post">{% csrf_token %}
<div>
{% if form.errors %}
<p class="errornote">
{% blocktrans count counter=form.errors.items|length %}Please correct the error below.{% plural %}Please correct the errors below.{% endblocktrans %}
</p>
{% endif %}
<h1>{% trans 'Password change' %}</h1>
<p>{% trans "Please enter your old password, for security's sake, and then enter your new password twice so we can verify you typed it in correctly." %}</p>
<fieldset class="module aligned wide">
<div class="form-row">
{{ form.old_password.errors }}
<label for="id_old_password" class="required">{% trans 'Old password' %}:</label>{{ form.old_password }}
</div>
<div class="form-row">
{{ form.new_password1.errors }}
<label for="id_new_password1" class="required">{% trans 'New password' %}:</label>{{ form.new_password1 }}
</div>
<div class="form-row">
{{ form.new_password2.errors }}
<label for="id_new_password2" class="required">{% trans 'Password (again)' %}:</label>{{ form.new_password2 }}
</div>
</fieldset>
<div class="submit-row">
<input type="submit" value="{% trans 'Change my password' %}" class="default" />
</div>
<script type="text/javascript">document.getElementById("id_old_password").focus();</script>
</div>
</form></div>
{% endblock %}

View File

@@ -0,0 +1,23 @@
{% extends "base.html" %}
{% load i18n %}
{% load url from future %}
{% block breadcrumbs %}
<div class="breadcrumbs">
<a href="{% url 'admin:index' %}">{% trans 'Home' %}</a>
&rsaquo; {% trans 'Password reset' %}
</div>
{% endblock %}
{% block title %}{% trans 'Password reset complete' %}{% endblock %}
{% block content %}
<div class="col-sm-12">
<h1>{% trans 'Password reset complete' %}</h1>
<p>{% trans "Your password has been set. You may go ahead and log in now." %}</p>
<p><a href="{{ login_url }}">{% trans 'Log in' %}</a></p>
</div>
{% endblock %}

View File

@@ -0,0 +1,61 @@
{% extends "base.html" %}
{% load i18n %}
{% load widget_tweaks %}
{% load url from future %}
{% block breadcrumbs %}
<div class="breadcrumbs">
<a href="{% url 'admin:index' %}">{% trans 'Home' %}</a>
&rsaquo; {% trans 'Password reset confirmation' %}
</div>
{% endblock %}
{% block title %}{% trans 'Password reset' %}{% endblock %}
{% block content %}
{% if validlink %}
<div class="col-sm-12">
<h1>{% trans 'Enter new password' %}</h1>
<p>{% trans "Please enter your new password twice so we can verify you typed it in correctly." %}</p>
<div class="col-sm-8 col-sm-offset-2 well">
<form action="" method="post" role="form" class="form-horizontal">{% csrf_token %}
{% if form.errors %}
{% include 'form_errors.html' %}
{% endif %}
<div class="form-group">
<label for="{{form.new_password1.id_for_label}}" class="col-sm-4 control-label">{{form.new_password1.label}}</label>
<div class="col-sm-8">
{% render_field form.new_password1 class+="form-control" %}
</div>
</div>
<div class="form-group">
<label for="{{form.new_password2.id_for_label}}" class="col-sm-4 control-label">{{form.new_password2.label}}</label>
<div class="col-sm-8">
{% render_field form.new_password2 class+="form-control" %}
</div>
</div>
<div class="col-sm-12">
<div class="pull-right">
<div class="form-group">
<input type="submit" value="{% trans 'Change my password' %}" class="btn btn-primary" />
</div>
</div>
</div>
</form>
</div>
{% else %}
<h1>{% trans 'Password reset unsuccessful' %}</h1>
<p>{% trans "The password reset link was invalid, possibly because it has already been used. Please request a new password reset." %}</p>
</div>
{% endif %}
{% endblock %}

View File

@@ -0,0 +1,20 @@
{% extends "base.html" %}
{% load i18n %}
{% load url from future %}
{% block breadcrumbs %}
<div class="breadcrumbs">
<a href="{% url 'admin:index' %}">{% trans 'Home' %}</a>
&rsaquo; {% trans 'Password reset' %}
</div>
{% endblock %}
{% block title %}{% trans 'Password reset successful' %}{% endblock %}
{% block content %}
<div class="col-sm-12">
<h1>{% trans 'Password reset successful' %}</h1>
<p>{% trans "We've e-mailed you instructions for setting your password to the e-mail address you submitted. You should be receiving it shortly." %}</p>
</div>
{% endblock %}

View File

@@ -0,0 +1,14 @@
{% load i18n %}{% load url from future %}{% autoescape off %}
{% blocktrans %}You're receiving this e-mail 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.username }}
{% trans "Thanks for using our site!" %}
{% blocktrans %}The {{ site_name }} team{% endblocktrans %}
{% endautoescape %}

View File

@@ -0,0 +1,34 @@
{% extends 'base.html' %}
{% load i18n %}
{% load widget_tweaks %}
{% block title %}Password reset{% endblock %}
{% block content %}
<div class="col-sm-12">
<h1>Password Reset</h1>
<p>{% trans "Forgotten your password? Enter your e-mail address below, and we'll e-mail instructions for setting a new one." %}</p>
<div class="col-sm-8 col-sm-offset-2 well">
<form action="" method="POST" role="form" class="form-horizontal">{% csrf_token %}
{% if form.errors %}
{% include 'form_errors.html' %}
{% endif %}
<div class="form-group">
<label for="{{form.email.id_for_label}}" class="col-sm-2 control-label">{{form.email.label}}</label>
<div class="col-sm-10">
{% render_field form.email type="email" class+="form-control" %}
</div>
</div>
<div class="col-sm-12">
<div class="pull-right">
<div class="form-group">
<input type="submit" value="Submit" class="btn btn-primary" />
</div>
</div>
</div>
</form>
</div>
</div>
{% endblock %}

View File

@@ -0,0 +1,10 @@
{% extends 'base.html' %}
{% block title %}Registration complete{% endblock %}
{% block content %}
<div class="alert alert-success">
<h2>Thanks for registering</h2>
<p>Thanks for registering with RIGS, you application will now be moderated by an administrator and further instructions will be emailed to you</p>
</div>
{% endblock %}

View File

@@ -0,0 +1,3 @@
You account has been created but now requires approval by one of our moderation team.
Please wait while this is done.

View File

@@ -0,0 +1 @@
{{ site }} User Awaiting Approval

View File

@@ -0,0 +1,32 @@
{% extends 'base.html' %}
{% load widget_tweaks %}
{% block title %}Registration{% endblock %}
{% block content %}
{% if form.errors or supplement_form.errors %}
<div class="alert alert-danger">
{{form.errors}}
{{supplement_form.errors}}
</div>
{% endif %}
<form action="" method="post" class="form-horizontal" role="form">{% csrf_token %}
{% for field in form %}
<div class="form-group">
<label for="{{ field.id_for_label }}" class="control-label col-sm-2">{{ field.label }}</label>
<div class="controls col-sm-10">
{% render_field field class+="form-control" placeholder=field.label %}
</div>
</div>
{% endfor %}
{% for field in supplement_form %}
<div class="form-group">
<label for="{{ field.id_for_label }}" class="control-label col-sm-2">{{ field.label }}</label>
<div class="controls col-sm-10">
{% render_field field class+="form-control" placeholder=field.label %}
</div>
</div>
{% endfor %}
<p><input type="submit" value="Register" class="btn btn-primary pull-right"></p>
</form>
{% endblock %}