Files
octopus/myproject/templates/change_password.html

56 lines
2.3 KiB
HTML

{% extends 'base.html' %}
{% block title %}Смена пароля{% endblock %}
{% block content %}
<div class="container">
<div class="form-container">
<h2 class="text-center mb-4">Смена пароля</h2>
<form method="post">
{% csrf_token %}
<div class="mb-3">
{% include 'accounts/password_input.html' with field_name=form.old_password.id_for_label field_label='Старый пароль' required=True field_errors=form.old_password.errors %}
</div>
<div class="mb-3">
{% include 'accounts/password_input.html' with field_name=form.new_password1.id_for_label field_label='Новый пароль' required=True field_errors=form.new_password1.errors %}
</div>
<div class="mb-3">
{% include 'accounts/password_input.html' with field_name=form.new_password2.id_for_label field_label='Подтверждение нового пароля' required=True field_errors=form.new_password2.errors %}
</div>
<div class="d-grid gap-2 d-md-flex justify-content-md-end">
<a href="{% url 'accounts:profile' %}" class="btn btn-outline-secondary me-md-2">
<i class="bi bi-arrow-left me-1"></i> Отмена
</a>
<button type="submit" class="btn btn-primary">
<i class="bi bi-save me-1"></i> Сохранить изменения
</button>
</div>
</form>
</div>
</div>
<script>
// Добавляем обработчик для показа/скрытия пароля
document.querySelectorAll('.show-password-btn').forEach(button => {
button.addEventListener('click', function() {
const targetId = this.getAttribute('data-target');
const targetInput = document.getElementById(targetId);
const icon = this.querySelector('i');
if (targetInput.type === 'password') {
targetInput.type = 'text';
icon.classList.remove('bi-eye');
icon.classList.add('bi-eye-slash');
} else {
targetInput.type = 'password';
icon.classList.remove('bi-eye-slash');
icon.classList.add('bi-eye');
}
});
});
</script>
{% endblock %}