1
0
mirror of https://github.com/django/django.git synced 2024-12-22 17:16:24 +00:00

Fixed #34677 -- Made admin password reset templates more consistent.

This commit is contained in:
priyank.panchal 2023-06-25 23:46:06 +05:30 committed by Mariusz Felisiak
parent 1d0dfc0b92
commit 0016a42995
4 changed files with 31 additions and 11 deletions

View File

@ -809,6 +809,7 @@ answer newbie questions, and generally made Django that much better:
pradeep.gowda@gmail.com
Preston Holmes <preston@ptone.com>
Preston Timmons <prestontimmons@gmail.com>
Priyank Panchal <priyankpanchal872000@gmail.com>
Priyansh Saxena <askpriyansh@gmail.com>
Przemysław Buczkowski <przemub@przemub.pl>
Przemysław Suliga <http://suligap.net>

View File

@ -20,16 +20,22 @@
<input class="hidden" autocomplete="username" value="{{ form.user.get_username }}">
<div class="form-row field-password1">
{{ form.new_password1.errors }}
<div class="flex-container">
<label for="id_new_password1">{% translate 'New password:' %}</label>
{{ form.new_password1 }}
</div>
</div>
<div class="form-row field-password2">
{{ form.new_password2.errors }}
<div class="flex-container">
<label for="id_new_password2">{% translate 'Confirm password:' %}</label>
{{ form.new_password2 }}
</div>
<input type="submit" value="{% translate 'Change my password' %}">
</div>
</fieldset>
<div class="submit-row">
<input type="submit" value="{% translate 'Change my password' %}">
</div>
</form>
{% else %}

View File

@ -17,11 +17,15 @@
<fieldset class="module aligned">
<div class="form-row field-email">
{{ form.email.errors }}
<div class="flex-container">
<label for="id_email">{% translate 'Email address:' %}</label>
{{ form.email }}
</div>
<input type="submit" value="{% translate 'Reset my password' %}">
</div>
</fieldset>
<div class="submit-row">
<input type="submit" value="{% translate 'Reset my password' %}">
</div>
</form>
{% endblock %}

View File

@ -3197,26 +3197,35 @@ Adding a password reset feature
You can add a password reset feature to the admin site by adding a few lines to
your URLconf. Specifically, add these four patterns::
from django.contrib import admin
from django.contrib.auth import views as auth_views
path(
"admin/password_reset/",
auth_views.PasswordResetView.as_view(),
auth_views.PasswordResetView.as_view(
extra_context={"site_header": admin.site.site_header}
),
name="admin_password_reset",
),
path(
"admin/password_reset/done/",
auth_views.PasswordResetDoneView.as_view(),
auth_views.PasswordResetDoneView.as_view(
extra_context={"site_header": admin.site.site_header}
),
name="password_reset_done",
),
path(
"reset/<uidb64>/<token>/",
auth_views.PasswordResetConfirmView.as_view(),
auth_views.PasswordResetConfirmView.as_view(
extra_context={"site_header": admin.site.site_header}
),
name="password_reset_confirm",
),
path(
"reset/done/",
auth_views.PasswordResetCompleteView.as_view(),
auth_views.PasswordResetCompleteView.as_view(
extra_context={"site_header": admin.site.site_header}
),
name="password_reset_complete",
),