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 pradeep.gowda@gmail.com
Preston Holmes <preston@ptone.com> Preston Holmes <preston@ptone.com>
Preston Timmons <prestontimmons@gmail.com> Preston Timmons <prestontimmons@gmail.com>
Priyank Panchal <priyankpanchal872000@gmail.com>
Priyansh Saxena <askpriyansh@gmail.com> Priyansh Saxena <askpriyansh@gmail.com>
Przemysław Buczkowski <przemub@przemub.pl> Przemysław Buczkowski <przemub@przemub.pl>
Przemysław Suliga <http://suligap.net> Przemysław Suliga <http://suligap.net>

View File

@ -16,20 +16,26 @@
<p>{% translate "Please enter your new password twice so we can verify you typed it in correctly." %}</p> <p>{% translate "Please enter your new password twice so we can verify you typed it in correctly." %}</p>
<form method="post">{% csrf_token %} <form method="post">{% csrf_token %}
<fieldset class="module aligned"> <fieldset class="module aligned">
<input class="hidden" autocomplete="username" value="{{ form.user.get_username }}"> <input class="hidden" autocomplete="username" value="{{ form.user.get_username }}">
<div class="form-row field-password1"> <div class="form-row field-password1">
{{ form.new_password1.errors }} {{ form.new_password1.errors }}
<div class="flex-container">
<label for="id_new_password1">{% translate 'New password:' %}</label> <label for="id_new_password1">{% translate 'New password:' %}</label>
{{ form.new_password1 }} {{ form.new_password1 }}
</div>
</div> </div>
<div class="form-row field-password2"> <div class="form-row field-password2">
{{ form.new_password2.errors }} {{ form.new_password2.errors }}
<div class="flex-container">
<label for="id_new_password2">{% translate 'Confirm password:' %}</label> <label for="id_new_password2">{% translate 'Confirm password:' %}</label>
{{ form.new_password2 }} {{ form.new_password2 }}
</div>
</div> </div>
</fieldset>
<div class="submit-row">
<input type="submit" value="{% translate 'Change my password' %}"> <input type="submit" value="{% translate 'Change my password' %}">
</fieldset> </div>
</form> </form>
{% else %} {% else %}

View File

@ -14,14 +14,18 @@
<p>{% translate 'Forgotten your password? Enter your email address below, and well email instructions for setting a new one.' %}</p> <p>{% translate 'Forgotten your password? Enter your email address below, and well email instructions for setting a new one.' %}</p>
<form method="post">{% csrf_token %} <form method="post">{% csrf_token %}
<fieldset class="module aligned"> <fieldset class="module aligned">
<div class="form-row field-email"> <div class="form-row field-email">
{{ form.email.errors }} {{ form.email.errors }}
<div class="flex-container">
<label for="id_email">{% translate 'Email address:' %}</label> <label for="id_email">{% translate 'Email address:' %}</label>
{{ form.email }} {{ form.email }}
</div>
</div> </div>
</fieldset>
<div class="submit-row">
<input type="submit" value="{% translate 'Reset my password' %}"> <input type="submit" value="{% translate 'Reset my password' %}">
</fieldset> </div>
</form> </form>
{% endblock %} {% 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 You can add a password reset feature to the admin site by adding a few lines to
your URLconf. Specifically, add these four patterns:: your URLconf. Specifically, add these four patterns::
from django.contrib import admin
from django.contrib.auth import views as auth_views from django.contrib.auth import views as auth_views
path( path(
"admin/password_reset/", "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", name="admin_password_reset",
), ),
path( path(
"admin/password_reset/done/", "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", name="password_reset_done",
), ),
path( path(
"reset/<uidb64>/<token>/", "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", name="password_reset_confirm",
), ),
path( path(
"reset/done/", "reset/done/",
auth_views.PasswordResetCompleteView.as_view(), auth_views.PasswordResetCompleteView.as_view(
extra_context={"site_header": admin.site.site_header}
),
name="password_reset_complete", name="password_reset_complete",
), ),