Files
octopus/myproject/templates/index.html

97 lines
4.5 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{% extends 'base.html' %}
{% block title %}Вход{% endblock %}
{% block content %}
<div class="container d-flex align-items-center justify-content-center" style="min-height: 70vh;">
<div class="card shadow-sm" style="max-width: 420px; width: 100%;">
<div class="card-body p-4">
<!-- Заголовок -->
<div class="text-center mb-4">
<h3 class="fw-bold mb-2">Добро пожаловать</h3>
<p class="text-muted mb-0">Войдите в систему</p>
</div>
<!-- Сообщения об ошибках -->
{% if messages %}
{% for message in messages %}
{% if 'danger' in message.tags or 'error' in message.tags %}
<div class="alert alert-danger alert-dismissible fade show" role="alert">
{{ message }}
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
</div>
{% endif %}
{% endfor %}
{% endif %}
<!-- Форма входа -->
<form method="post">
{% csrf_token %}
<div class="mb-3">
<label for="email" class="form-label">Email</label>
<input type="email" class="form-control" id="email" name="email" required autofocus>
</div>
{% include 'accounts/password_input.html' with field_name='password' field_label='Пароль' required=True %}
<button type="submit" class="btn btn-primary w-100 py-2 mb-3">Войти</button>
<!-- Ссылка "Забыли пароль?" -->
<div class="text-center">
<a href="#" class="text-decoration-none text-muted" data-bs-toggle="modal" data-bs-target="#passwordResetModal">
<small>Забыли пароль?</small>
</a>
</div>
</form>
</div>
</div>
</div>
<!-- Модальное окно для восстановления пароля -->
<div class="modal fade" id="passwordResetModal" tabindex="-1" aria-labelledby="passwordResetModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="passwordResetModalLabel">Восстановление пароля</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Закрыть"></button>
</div>
<div class="modal-body">
<form id="passwordResetForm" method="post" action="{% url 'accounts:password_reset' %}">
{% csrf_token %}
<p>Пожалуйста, введите ваш email, и мы отправим вам инструкции по восстановлению пароля.</p>
<div class="mb-3">
<label for="resetEmail" class="form-label">Email</label>
<input type="email" class="form-control" id="resetEmail" name="email" required>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Отмена</button>
<button type="submit" class="btn btn-primary" form="passwordResetForm">Отправить</button>
</div>
</div>
</div>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
// Добавляем обработчик для показа/скрытия пароля
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 %}