смена пароля работает

This commit is contained in:
2024-01-19 16:07:47 +03:00
parent 345d807f06
commit a354a7bc48
4 changed files with 96 additions and 25 deletions

View File

@@ -0,0 +1,12 @@
{% extends 'base.html' %}
{% load static %}
{% block title %} Пароль изменен {% endblock %}
{% block header-title %}
<h1> Пароль аккаунта {{ target_user.login }} изменен! </h1>
{% endblock %}
{% block content %}
<p><a href="{% url 'index' %}" class="value-good">Вернуться на главную</a></p>
{% endblock %}

View File

@@ -10,12 +10,32 @@
<form method="POST">
{% csrf_token %}
{% for field in form %}
{% if old_password_required %}
<div class="form-row">
<label for="current_password">Текущий пароль</label>
<input type="password" name="current_password" id="current_password" required
{% if not old_password_wrong %}value="{{ request.POST.current_password }}"{% endif %}/>
{% if old_password_wrong %}
<p class="value-bad"> Проверьте правильность ввода пароля </p>
{% endif %}
</div>
{% endif %}
<div class="form-row">
{{ field.label_tag }} {{ field }}
{{ field.errors }}
<label for="password1">Новый пароль</label>
<input type="password" name="password1" id="password1" required/>
{% for err in new_password_errors %}
<p class="value-bad">{{ err }}</p>
{% endfor %}
</div>
<div class="form-row">
<label for="password2">Подтверждение нового пароля</label>
<input type="password" name="password2" id="password2" required/>
{% if not new_password_equals %}
<p class="value-bad"> Пароли не совпадают </p>
{% endif %}
</div>
{% endfor %}
<div class="form-row">
<input id="submit" type="submit" value="Подтвердить">