From c2beb24487f29edbf05ea57f98ccdf0093f01b12 Mon Sep 17 00:00:00 2001 From: tjp03u Date: Thu, 23 Oct 2014 22:13:03 +0100 Subject: [PATCH] Set up authentication system --- .idea/.name | 1 + .idea/PyRIGS.iml | 26 ++++ .idea/dataSources.ids | 6 + .idea/dataSources.xml | 12 ++ .idea/encodings.xml | 5 + .idea/misc.xml | 5 + .idea/modules.xml | 9 ++ .idea/scopes/scope_settings.xml | 5 + .idea/vcs.xml | 7 + PyRIGS/settings.py | 21 ++- PyRIGS/urls.py | 4 + RIGS/migrations/0001_initial.py | 42 ++++++ RIGS/models.py | 13 ++ RIGS/views.py | 8 + db.sqlite3 | Bin 0 -> 39936 bytes templates/404.html | 6 + templates/500.html | 6 + templates/base.html | 138 ++++++++++++++++++ templates/closemodal.html | 8 + templates/form_errors.html | 14 ++ templates/pagination.html | 27 ++++ templates/registration/acceptance_email.txt | 12 ++ .../registration/acceptance_email_subject.txt | 1 + .../registration/activation_complete.html | 10 ++ templates/registration/activation_email.txt | 5 + .../registration/activation_email_subject.txt | 1 + templates/registration/activation_form.html | 17 +++ templates/registration/logged_out.html | 10 ++ templates/registration/login.html | 7 + templates/registration/loginform.html | 22 +++ templates/registration/notification_email.txt | 3 + .../notification_email_subject.txt | 1 + .../registration/password_change_form.html | 56 +++++++ .../registration/password_reset_complete.html | 23 +++ .../registration/password_reset_confirm.html | 61 ++++++++ .../registration/password_reset_done.html | 20 +++ .../registration/password_reset_email.html | 14 ++ .../registration/password_reset_form.html | 34 +++++ .../registration/registration_complete.html | 10 ++ templates/registration/registration_email.txt | 3 + .../registration_email_subject.txt | 1 + templates/registration/registration_form.html | 32 ++++ 42 files changed, 705 insertions(+), 1 deletion(-) create mode 100644 .idea/.name create mode 100644 .idea/PyRIGS.iml create mode 100644 .idea/dataSources.ids create mode 100644 .idea/dataSources.xml create mode 100644 .idea/encodings.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/scopes/scope_settings.xml create mode 100644 .idea/vcs.xml create mode 100644 RIGS/migrations/0001_initial.py create mode 100644 db.sqlite3 create mode 100644 templates/404.html create mode 100644 templates/500.html create mode 100644 templates/base.html create mode 100644 templates/closemodal.html create mode 100644 templates/form_errors.html create mode 100644 templates/pagination.html create mode 100644 templates/registration/acceptance_email.txt create mode 100644 templates/registration/acceptance_email_subject.txt create mode 100644 templates/registration/activation_complete.html create mode 100644 templates/registration/activation_email.txt create mode 100644 templates/registration/activation_email_subject.txt create mode 100644 templates/registration/activation_form.html create mode 100644 templates/registration/logged_out.html create mode 100644 templates/registration/login.html create mode 100644 templates/registration/loginform.html create mode 100644 templates/registration/notification_email.txt create mode 100644 templates/registration/notification_email_subject.txt create mode 100644 templates/registration/password_change_form.html create mode 100644 templates/registration/password_reset_complete.html create mode 100644 templates/registration/password_reset_confirm.html create mode 100644 templates/registration/password_reset_done.html create mode 100644 templates/registration/password_reset_email.html create mode 100644 templates/registration/password_reset_form.html create mode 100644 templates/registration/registration_complete.html create mode 100644 templates/registration/registration_email.txt create mode 100644 templates/registration/registration_email_subject.txt create mode 100644 templates/registration/registration_form.html diff --git a/.idea/.name b/.idea/.name new file mode 100644 index 00000000..b822ae3d --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +PyRIGS \ No newline at end of file diff --git a/.idea/PyRIGS.iml b/.idea/PyRIGS.iml new file mode 100644 index 00000000..f023575e --- /dev/null +++ b/.idea/PyRIGS.iml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + diff --git a/.idea/dataSources.ids b/.idea/dataSources.ids new file mode 100644 index 00000000..b79da580 --- /dev/null +++ b/.idea/dataSources.ids @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/dataSources.xml b/.idea/dataSources.xml new file mode 100644 index 00000000..51b446d9 --- /dev/null +++ b/.idea/dataSources.xml @@ -0,0 +1,12 @@ + + + + + sqlite.xerial + org.sqlite.JDBC + jdbc:sqlite:C:\Users\psytp\PycharmProjects\PyRIGS\db.sqlite3 + + + + + diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 00000000..e206d70d --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 00000000..8f3f551e --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 00000000..cac4e07c --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/.idea/scopes/scope_settings.xml b/.idea/scopes/scope_settings.xml new file mode 100644 index 00000000..922003b8 --- /dev/null +++ b/.idea/scopes/scope_settings.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 00000000..275077f8 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/PyRIGS/settings.py b/PyRIGS/settings.py index 573813f3..4e378f6c 100644 --- a/PyRIGS/settings.py +++ b/PyRIGS/settings.py @@ -37,6 +37,9 @@ INSTALLED_APPS = ( 'django.contrib.messages', 'django.contrib.staticfiles', 'RIGS', + + 'registration', + 'widget_tweaks', ) 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 # https://docs.djangoproject.com/en/1.7/topics/i18n/ -LANGUAGE_CODE = 'en-us' +LANGUAGE_CODE = 'en-gb' TIME_ZONE = 'UTC' diff --git a/PyRIGS/urls.py b/PyRIGS/urls.py index 913c9699..2b2193b6 100644 --- a/PyRIGS/urls.py +++ b/PyRIGS/urls.py @@ -6,5 +6,9 @@ urlpatterns = patterns('', # url(r'^$', 'PyRIGS.views.home', name='home'), # 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)), ) diff --git a/RIGS/migrations/0001_initial.py b/RIGS/migrations/0001_initial.py new file mode 100644 index 00000000..62687347 --- /dev/null +++ b/RIGS/migrations/0001_initial.py @@ -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,), + ), + ] diff --git a/RIGS/models.py b/RIGS/models.py index 71a83623..c554f793 100644 --- a/RIGS/models.py +++ b/RIGS/models.py @@ -1,3 +1,16 @@ from django.db import models +from django.contrib.auth.models import AbstractUser +from django.conf import settings +import hashlib # 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 \ No newline at end of file diff --git a/RIGS/views.py b/RIGS/views.py index 91ea44a2..3bd17cd6 100644 --- a/RIGS/views.py +++ b/RIGS/views.py @@ -1,3 +1,11 @@ from django.shortcuts import render +from django.http.response import HttpResponseRedirect # 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) \ No newline at end of file diff --git a/db.sqlite3 b/db.sqlite3 new file mode 100644 index 0000000000000000000000000000000000000000..b7c8b42275564a479624763e56f4a98325075aa6 GIT binary patch literal 39936 zcmeHQUu+yl8QbP0ky~JC`@!hQ*pBq)F8?I4sVkb@_uuyfZ?X`2s z`R;OeZWA7$=Z1nRo_K)r(ms?Y9%uxp5~vbV1q2BRfy5K=PzfpJ0a5;mJ`@l$v$MOi zdwX^gpF$4LwHfcsd^6uSzxli0H#2+b;<;Sa(p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{!hBPYS zic8n5a)<^QXlZcSDxot-&Pk?J@N=+s=Bs&gZAh!EoB2HY)~vQssN~kr z@gDZn61{zE9erNVTtkxBtmp@65xd~AH_xhxKUm8enM1Db^sJiXbQCE|-A8ZPJlNLZ zB-Z)-zq8Sfr{)N>G6KB+w{q=q**O9`Lx9`=c7`8M%@Js21o-^l%C*O3=LqZ!fe!KS zf(&W`d|CV${9Ak%J@Vh9MBod9ih5E9wE?2%qk0~CH+^=+nnbr7ok;nEkNPxu{x~-Y zQQi6Du+qo6S<02IEWVEh-DPy*u%hZZ*gVQ=>L_!6+IXmzj*{Yx9g(kFw>;I^1ba!( zg@v={XBHN<*~}u+eL3_<60=@2#)=v81*el*M4i_gZP52i?tb@%ay)`+SNh_Uih61+ zfV!)5%v$NGMABTDpgFk_PlX}x#=6N^?A=%l64CmSTcjcbwg6*nwY#+Lg;_xXhPD>K zxtyz^06~o-*Z)1rzRr1Z1RgU4`1}83Rv}y*j=&>CfWQAgLa;e2j=*Dv0Pp{gS%q+M KI0BClf&T)9sB7l{ literal 0 HcmV?d00001 diff --git a/templates/404.html b/templates/404.html new file mode 100644 index 00000000..281fe9ca --- /dev/null +++ b/templates/404.html @@ -0,0 +1,6 @@ +{% extends 'base.html' %} +{% block title %}Page not found{% endblock %} + +{% block content %} +The page you requested could not be found. +{% endblock %} diff --git a/templates/500.html b/templates/500.html new file mode 100644 index 00000000..ea97b712 --- /dev/null +++ b/templates/500.html @@ -0,0 +1,6 @@ +{% extends 'base.html' %} +{% block title %}Server error{% endblock %} + +{% block content %} +There was an error while handling your request. +{% endblock %} diff --git a/templates/base.html b/templates/base.html new file mode 100644 index 00000000..d35f23b5 --- /dev/null +++ b/templates/base.html @@ -0,0 +1,138 @@ +{% load static from staticfiles %} + + + + + {% block title %}{% endblock %} | Rig Information Gathering System + + + + + {% block css %} + {% endblock %} + + {% block preload_js %} + {% endblock %} + + {% block extra-head %}{% endblock %} + + + + + +
+
+ {% block content-header %} + {% if error %}
{{ error }}
{% endif %} + {% if info %}
{{ info }}
{% endif %} + {% if messages %} + {% for message in messages %} +
{{ message }}
+ {% endfor %} + {% endif %} + {% endblock %} + + {% block content %}{% endblock %} +
+ + +
+ + + + + + + + + {% block js %} + {% endblock %} + + diff --git a/templates/closemodal.html b/templates/closemodal.html new file mode 100644 index 00000000..56f2e90d --- /dev/null +++ b/templates/closemodal.html @@ -0,0 +1,8 @@ +{% if messages %} + {% for message in messages %} + + {% endfor %} +{% endif %} + \ No newline at end of file diff --git a/templates/form_errors.html b/templates/form_errors.html new file mode 100644 index 00000000..03864874 --- /dev/null +++ b/templates/form_errors.html @@ -0,0 +1,14 @@ +{% load nice_errors from filters %} +{% if form.errors %} +
+ +
+ {% with form|nice_errors as qq %} + {% for error_name,desc in qq.items %} +
{{error_name}}
+
{{desc}}
+ {% endfor %} + {% endwith %} +
+
+{% endif %} \ No newline at end of file diff --git a/templates/pagination.html b/templates/pagination.html new file mode 100644 index 00000000..dec49e47 --- /dev/null +++ b/templates/pagination.html @@ -0,0 +1,27 @@ +{% if is_paginated %} +
+
    + {% if page_obj.has_previous %} +
  • + {% else %} + + {% endif %} + {% for page in pages %} + {% if page %} + {% ifequal page page_obj.number %} +
  • {{ page }}
  • + {% else %} +
  • {{ page }}
  • + {% endifequal %} + {% else %} + ... + {% endif %} + {% endfor %} + {% if page_obj.has_next %} +
  • + {% else %} + + {% endif %} +
+
+{% endif %} \ No newline at end of file diff --git a/templates/registration/acceptance_email.txt b/templates/registration/acceptance_email.txt new file mode 100644 index 00000000..ece37f81 --- /dev/null +++ b/templates/registration/acceptance_email.txt @@ -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 %} \ No newline at end of file diff --git a/templates/registration/acceptance_email_subject.txt b/templates/registration/acceptance_email_subject.txt new file mode 100644 index 00000000..cc20c8a7 --- /dev/null +++ b/templates/registration/acceptance_email_subject.txt @@ -0,0 +1 @@ +{{ site }} user {{ user }} activation {{ activation_key }} \ No newline at end of file diff --git a/templates/registration/activation_complete.html b/templates/registration/activation_complete.html new file mode 100644 index 00000000..4797ef69 --- /dev/null +++ b/templates/registration/activation_complete.html @@ -0,0 +1,10 @@ +{% extends 'base.html' %} + +{% block title %}Activation Complete{% endblock %} + +{% block content %} +
+

Activation Complete

+

You user account is now fully registered. Enjoy RIGS

+
+{% endblock %} \ No newline at end of file diff --git a/templates/registration/activation_email.txt b/templates/registration/activation_email.txt new file mode 100644 index 00000000..6574286f --- /dev/null +++ b/templates/registration/activation_email.txt @@ -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 %} \ No newline at end of file diff --git a/templates/registration/activation_email_subject.txt b/templates/registration/activation_email_subject.txt new file mode 100644 index 00000000..e35ae77a --- /dev/null +++ b/templates/registration/activation_email_subject.txt @@ -0,0 +1 @@ +{{ user }} activation successful \ No newline at end of file diff --git a/templates/registration/activation_form.html b/templates/registration/activation_form.html new file mode 100644 index 00000000..2df0849b --- /dev/null +++ b/templates/registration/activation_form.html @@ -0,0 +1,17 @@ +{% extends 'base.html' %} +{% load widget_tweaks %} +{% block title %}Activation{% endblock %} + +{% block content %} +
{% csrf_token %} + {% for field in form %} +
+ +
+ {% render_field field class+="form-control" placeholder=field.label %} +
+
+ {% endfor %} +

+
+{% endblock %} \ No newline at end of file diff --git a/templates/registration/logged_out.html b/templates/registration/logged_out.html new file mode 100644 index 00000000..47a0abc6 --- /dev/null +++ b/templates/registration/logged_out.html @@ -0,0 +1,10 @@ +{% extends 'base.html' %} + +{% block title %}Logout Successful{% endblock %} + +{% block content %} +
+

Logout Successful

+

You have successfully been logged out of RIGS

+
+{% endblock %} \ No newline at end of file diff --git a/templates/registration/login.html b/templates/registration/login.html new file mode 100644 index 00000000..ace80d16 --- /dev/null +++ b/templates/registration/login.html @@ -0,0 +1,7 @@ +{% extends 'base.html' %} + +{% block title %}Login{% endblock %} + +{% block content %} +{% include 'registration/loginform.html' %} +{% endblock %} \ No newline at end of file diff --git a/templates/registration/loginform.html b/templates/registration/loginform.html new file mode 100644 index 00000000..45bfe5f1 --- /dev/null +++ b/templates/registration/loginform.html @@ -0,0 +1,22 @@ +{% load url from future %} +{% load widget_tweaks %} +{% if form.errors %} +
Your username or password was incorrect
+{% endif %} +
+ +
{% csrf_token %} +
+ + {% render_field form.username class+="form-control" placeholder=form.username.label %} +
+
+ + {% render_field form.password class+="form-control" placeholder=form.password.label %} +
+ Register + Forgotten Password + + +
+
\ No newline at end of file diff --git a/templates/registration/notification_email.txt b/templates/registration/notification_email.txt new file mode 100644 index 00000000..33c46ba9 --- /dev/null +++ b/templates/registration/notification_email.txt @@ -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. \ No newline at end of file diff --git a/templates/registration/notification_email_subject.txt b/templates/registration/notification_email_subject.txt new file mode 100644 index 00000000..a7b01a57 --- /dev/null +++ b/templates/registration/notification_email_subject.txt @@ -0,0 +1 @@ +{{ site }} New User Approval Require \ No newline at end of file diff --git a/templates/registration/password_change_form.html b/templates/registration/password_change_form.html new file mode 100644 index 00000000..ea8abb41 --- /dev/null +++ b/templates/registration/password_change_form.html @@ -0,0 +1,56 @@ +{% extends "admin/base_site.html" %} +{% load i18n static %} +{% load url from future %} +{% block extrastyle %}{{ block.super }}{% endblock %} +{% block userlinks %}{% url 'django-admindocs-docroot' as docsroot %}{% if docsroot %}{% trans 'Documentation' %} / {% endif %} {% trans 'Change password' %} / {% trans 'Log out' %}{% endblock %} +{% block breadcrumbs %} + +{% endblock %} + +{% block title %}{% trans 'Password change' %}{% endblock %} + +{% block content %}
+ +
{% csrf_token %} +
+{% if form.errors %} +

+ {% blocktrans count counter=form.errors.items|length %}Please correct the error below.{% plural %}Please correct the errors below.{% endblocktrans %} +

+{% endif %} + +

{% trans 'Password change' %}

+ +

{% 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." %}

+ +
+ +
+ {{ form.old_password.errors }} + {{ form.old_password }} +
+ +
+ {{ form.new_password1.errors }} + {{ form.new_password1 }} +
+ +
+{{ form.new_password2.errors }} + {{ form.new_password2 }} +
+ +
+ +
+ +
+ + +
+
+ +{% endblock %} diff --git a/templates/registration/password_reset_complete.html b/templates/registration/password_reset_complete.html new file mode 100644 index 00000000..9a2230b5 --- /dev/null +++ b/templates/registration/password_reset_complete.html @@ -0,0 +1,23 @@ +{% extends "base.html" %} +{% load i18n %} +{% load url from future %} + +{% block breadcrumbs %} + +{% endblock %} + +{% block title %}{% trans 'Password reset complete' %}{% endblock %} + +{% block content %} +
+

{% trans 'Password reset complete' %}

+ +

{% trans "Your password has been set. You may go ahead and log in now." %}

+ +

{% trans 'Log in' %}

+
+ +{% endblock %} diff --git a/templates/registration/password_reset_confirm.html b/templates/registration/password_reset_confirm.html new file mode 100644 index 00000000..dbf69a4e --- /dev/null +++ b/templates/registration/password_reset_confirm.html @@ -0,0 +1,61 @@ +{% extends "base.html" %} +{% load i18n %} +{% load widget_tweaks %} +{% load url from future %} + +{% block breadcrumbs %} + +{% endblock %} + +{% block title %}{% trans 'Password reset' %}{% endblock %} + +{% block content %} + +{% if validlink %} +
+ +

{% trans 'Enter new password' %}

+ +

{% trans "Please enter your new password twice so we can verify you typed it in correctly." %}

+ +
+
{% csrf_token %} + {% if form.errors %} + {% include 'form_errors.html' %} + {% endif %} +
+ +
+ {% render_field form.new_password1 class+="form-control" %} +
+
+
+ +
+ {% render_field form.new_password2 class+="form-control" %} +
+
+
+
+
+ +
+
+
+
+
+ + {% else %} + +

{% trans 'Password reset unsuccessful' %}

+ +

{% trans "The password reset link was invalid, possibly because it has already been used. Please request a new password reset." %}

+ +
+ +{% endif %} + +{% endblock %} diff --git a/templates/registration/password_reset_done.html b/templates/registration/password_reset_done.html new file mode 100644 index 00000000..67b85061 --- /dev/null +++ b/templates/registration/password_reset_done.html @@ -0,0 +1,20 @@ +{% extends "base.html" %} +{% load i18n %} +{% load url from future %} + +{% block breadcrumbs %} + +{% endblock %} + +{% block title %}{% trans 'Password reset successful' %}{% endblock %} + +{% block content %} +
+

{% trans 'Password reset successful' %}

+ +

{% trans "We've e-mailed you instructions for setting your password to the e-mail address you submitted. You should be receiving it shortly." %}

+
+{% endblock %} diff --git a/templates/registration/password_reset_email.html b/templates/registration/password_reset_email.html new file mode 100644 index 00000000..4743e04c --- /dev/null +++ b/templates/registration/password_reset_email.html @@ -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 %} diff --git a/templates/registration/password_reset_form.html b/templates/registration/password_reset_form.html new file mode 100644 index 00000000..bbe77669 --- /dev/null +++ b/templates/registration/password_reset_form.html @@ -0,0 +1,34 @@ +{% extends 'base.html' %} +{% load i18n %} +{% load widget_tweaks %} + +{% block title %}Password reset{% endblock %} + +{% block content %} +
+

Password Reset

+ +

{% trans "Forgotten your password? Enter your e-mail address below, and we'll e-mail instructions for setting a new one." %}

+ +
+
{% csrf_token %} + {% if form.errors %} + {% include 'form_errors.html' %} + {% endif %} +
+ +
+ {% render_field form.email type="email" class+="form-control" %} +
+
+
+
+
+ +
+
+
+
+
+
+{% endblock %} \ No newline at end of file diff --git a/templates/registration/registration_complete.html b/templates/registration/registration_complete.html new file mode 100644 index 00000000..23827032 --- /dev/null +++ b/templates/registration/registration_complete.html @@ -0,0 +1,10 @@ +{% extends 'base.html' %} + +{% block title %}Registration complete{% endblock %} + +{% block content %} +
+

Thanks for registering

+

Thanks for registering with RIGS, you application will now be moderated by an administrator and further instructions will be emailed to you

+
+{% endblock %} \ No newline at end of file diff --git a/templates/registration/registration_email.txt b/templates/registration/registration_email.txt new file mode 100644 index 00000000..a32116ee --- /dev/null +++ b/templates/registration/registration_email.txt @@ -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. \ No newline at end of file diff --git a/templates/registration/registration_email_subject.txt b/templates/registration/registration_email_subject.txt new file mode 100644 index 00000000..7d469366 --- /dev/null +++ b/templates/registration/registration_email_subject.txt @@ -0,0 +1 @@ +{{ site }} User Awaiting Approval \ No newline at end of file diff --git a/templates/registration/registration_form.html b/templates/registration/registration_form.html new file mode 100644 index 00000000..aa6ec221 --- /dev/null +++ b/templates/registration/registration_form.html @@ -0,0 +1,32 @@ +{% extends 'base.html' %} +{% load widget_tweaks %} +{% block title %}Registration{% endblock %} + +{% block content %} +{% if form.errors or supplement_form.errors %} +
+ {{form.errors}} + {{supplement_form.errors}} +
+{% endif %} + +
{% csrf_token %} + {% for field in form %} +
+ +
+ {% render_field field class+="form-control" placeholder=field.label %} +
+
+ {% endfor %} + {% for field in supplement_form %} +
+ +
+ {% render_field field class+="form-control" placeholder=field.label %} +
+
+ {% endfor %} +

+
+{% endblock %} \ No newline at end of file