Author: lukeplant
Date: 2011-12-23 16:14:45 -0800 (Fri, 23 Dec 2011)
New Revision: 17266

Modified:
   django/trunk/django/contrib/admin/static/admin/css/login.css
   django/trunk/django/contrib/admin/templates/admin/login.html
   django/trunk/docs/releases/1.4.txt
   django/trunk/docs/topics/auth.txt
Log:
Added a password reset link to default admin login page if a password reset URL 
is available.

You no longer have to override the admin login page just to get that link to
appear!

Also provided much better docs for how to plug in the provided password
reset mechanism with minimum effort.

Modified: django/trunk/django/contrib/admin/static/admin/css/login.css
===================================================================
--- django/trunk/django/contrib/admin/static/admin/css/login.css        
2011-12-23 19:18:44 UTC (rev 17265)
+++ django/trunk/django/contrib/admin/static/admin/css/login.css        
2011-12-24 00:14:45 UTC (rev 17266)
@@ -52,3 +52,6 @@
     padding: 1em 0 0 9.4em;
 }
 
+.login .password-reset-link {
+    text-align: center;
+}

Modified: django/trunk/django/contrib/admin/templates/admin/login.html
===================================================================
--- django/trunk/django/contrib/admin/templates/admin/login.html        
2011-12-23 19:18:44 UTC (rev 17265)
+++ django/trunk/django/contrib/admin/templates/admin/login.html        
2011-12-24 00:14:45 UTC (rev 17266)
@@ -1,5 +1,6 @@
 {% extends "admin/base_site.html" %}
 {% load i18n admin_static %}
+{% load url from future %}
 
 {% block extrastyle %}{{ block.super }}<link rel="stylesheet" type="text/css" 
href="{% static "admin/css/login.css" %}" />{% endblock %}
 
@@ -38,6 +39,12 @@
     <input type="hidden" name="this_is_the_login_form" value="1" />
     <input type="hidden" name="next" value="{{ next }}" />
   </div>
+  {% url 'admin_password_reset' as password_reset_url %}
+  {% if password_reset_url %}
+  <div class="password-reset-link">
+    <a href="{{ password_reset_url }}">{% trans 'Forgotten your password or 
username?' %}</a>
+  </div>
+  {% endif %}
   <div class="submit-row">
     <label>&nbsp;</label><input type="submit" value="{% trans 'Log in' %}" />
   </div>

Modified: django/trunk/docs/releases/1.4.txt
===================================================================
--- django/trunk/docs/releases/1.4.txt  2011-12-23 19:18:44 UTC (rev 17265)
+++ django/trunk/docs/releases/1.4.txt  2011-12-24 00:14:45 UTC (rev 17266)
@@ -546,6 +546,11 @@
   For more details, see the documentation for
   :meth:`~django.db.models.query.QuerySet.distinct`.
 
+* The admin login page will add a password reset link if you include a URL with
+  the name `'admin_password_reset'` in your urls.py, so plugging in the builtin
+  password reset mechanism and making it available is now much easier. For
+  details, see :ref:`auth_password_reset`.
+
 Backwards incompatible changes in 1.4
 =====================================
 

Modified: django/trunk/docs/topics/auth.txt
===================================================================
--- django/trunk/docs/topics/auth.txt   2011-12-23 19:18:44 UTC (rev 17265)
+++ django/trunk/docs/topics/auth.txt   2011-12-24 00:14:45 UTC (rev 17266)
@@ -371,6 +371,34 @@
 directly unless you know what you're doing. This is explained in the next
 section.
 
+.. _auth_password_reset:
+
+User-requested password resets
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+There is a bundled reset mechanism that integrates into the admin, allowing
+users to reset their passwords by email. It can be customized and is described
+in detail below under :func:`~django.contrib.auth.views.password_reset`. To
+enable it without customization, add lines something like the following to your
+urls.py:
+
+.. code-block:: python
+
+    url(r'^admin/password_reset/$', 
'django.contrib.auth.views.password_reset', name='admin_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'),
+
+(This assumes you've added the admin at ``admin/``, and requires that you put
+the URLs starting with ``^admin/`` before the line that includes the admin app
+itself).
+
+.. versionchanged:: 1.4
+
+The presence of the 'admin_password_reset' named URL will cause a "forgotten
+your password?" link to appear on the default admin login page under the
+password box.
+
 .. _auth_password_storage:
 
 How Django stores passwords

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to