Commits

Luke Plant  committed 4c918d6

Added link to password reset on login page.

  • Participants
  • Parent commits 51ab390

Comments (0)

Files changed (3)

File christchurch/settings.py

 ROOT_URLCONF = 'christchurch.urls'
 
 INSTALLED_APPS = [
+    'christchurch',  # Our templates before anyone else's
+    'sermons',
+    'contacts',
     'django.contrib.auth',
     'django.contrib.contenttypes',
     'django.contrib.sessions',
     'django.contrib.staticfiles',
     'django.contrib.admin',
     'south',
-    'christchurch',
-    'sermons',
-    'contacts',
     'cms',
     'menus',
     'mptt',

File christchurch/templates/admin/login.html

+{% extends "admin/base_site.html" %}
+{% load url from future %}
+{% load i18n %}
+
+{% block extrastyle %}{% load adminmedia %}{{ block.super }}<link rel="stylesheet" type="text/css" href="{% admin_media_prefix %}css/login.css" />{% endblock %}
+
+{% block bodyclass %}login{% endblock %}
+
+{% block nav-global %}{% endblock %}
+
+{% block content_title %}{% endblock %}
+
+{% block breadcrumbs %}{% endblock %}
+
+{% block content %}
+{% if form.errors and not form.non_field_errors and not form.this_is_the_login_form.errors %}
+<p class="errornote">
+{% blocktrans count form.errors.items|length as counter %}Please correct the error below.{% plural %}Please correct the errors below.{% endblocktrans %}
+</p>
+{% endif %}
+
+{% if form.non_field_errors or form.this_is_the_login_form.errors %}
+{% for error in form.non_field_errors|add:form.this_is_the_login_form.errors %}
+<p class="errornote">
+    {{ error }}
+</p>
+{% endfor %}
+{% endif %}
+
+<div id="content-main">
+<form action="{{ app_path }}" method="post" id="login-form">{% csrf_token %}
+  <div class="form-row">
+    {% if not form.this_is_the_login_form.errors %}{{ form.username.errors }}{% endif %}
+    <label for="id_username" class="required">{% trans 'Username:' %}</label> {{ form.username }}
+  </div>
+  <div class="form-row">
+    {% if not form.this_is_the_login_form.errors %}{{ form.password.errors }}{% endif %}
+    <label for="id_password" class="required">{% trans 'Password:' %}</label> {{ form.password }}
+    <input type="hidden" name="this_is_the_login_form" value="1" />
+    <input type="hidden" name="next" value="{{ next }}" />
+  </div>
+  <div class="submit-row">
+    <label>&nbsp;</label><input type="submit" value="{% trans 'Log in' %}" />
+  </div>
+  <div>
+    <br/>
+    <a href="{% url 'django.contrib.auth.views.password_reset' %}">Forgotten your password or username? Click here.</a>
+  </div>
+</form>
+
+<script type="text/javascript">
+document.getElementById('id_username').focus()
+</script>
+</div>
+{% endblock %}

File christchurch/urls.py

                        url(r'^thissunday/$', 'christchurch.views.this_sunday'),
                        url(r'^upcoming-midweek/$', 'christchurch.views.upcoming_midweek'),
                        url(r'^semantic/', include('semanticeditor.urls')),
+
+                       # Plug in the password reset views
+                       (r'^admin/password_reset/$', 'django.contrib.auth.views.password_reset'),
+                       (r'^admin/password_reset/done/$', 'django.contrib.auth.views.password_reset_done'),
+                       (r'^reset/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/$', 'django.contrib.auth.views.password_reset_confirm'),
+                       (r'^reset/done/$', 'django.contrib.auth.views.password_reset_complete'),
+
                        url(r'^admin/', include(admin.site.urls)),
                        url(r'^', include('cms.urls')),
                        # Sermons views included via apphooks