Initial commit: Django inventory system
This commit is contained in:
29
myproject/accounts/templates/accounts/password_input.html
Normal file
29
myproject/accounts/templates/accounts/password_input.html
Normal file
@@ -0,0 +1,29 @@
|
||||
<!-- Компонент для поля ввода пароля с возможностью показать/скрыть -->
|
||||
{% comment %}
|
||||
Использование:
|
||||
{% include 'accounts/password_input.html' with field_name='password1' field_label='Пароль' required=True %}
|
||||
{% endcomment %}
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="{{ field_name }}" class="form-label">{{ field_label|default:"Пароль" }}</label>
|
||||
<div class="input-group">
|
||||
<input
|
||||
type="password"
|
||||
class="form-control"
|
||||
id="{{ field_name }}"
|
||||
name="{{ field_name }}"
|
||||
{% if required %}required{% endif %}
|
||||
{% if placeholder %}placeholder="{{ placeholder }}"{% endif %}
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-outline-secondary show-password-btn"
|
||||
data-target="{{ field_name }}"
|
||||
>
|
||||
<i class="bi bi-eye"></i>
|
||||
</button>
|
||||
</div>
|
||||
{% if field_errors %}
|
||||
<div class="text-danger">{{ field_errors }}</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
@@ -0,0 +1,48 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block title %}Сброс пароля{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container">
|
||||
<div class="form-container">
|
||||
<h2 class="text-center mb-4">Сброс пароля</h2>
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane fade show active" id="reset-password">
|
||||
<form method="post">
|
||||
{% csrf_token %}
|
||||
{% include 'accounts/password_input.html' with field_name='password1' field_label='Новый пароль' required=True %}
|
||||
{% include 'accounts/password_input.html' with field_name='password2' field_label='Подтверждение пароля' required=True %}
|
||||
<button type="submit" class="btn btn-primary w-100">Сбросить пароль</button>
|
||||
</form>
|
||||
|
||||
<!-- Ссылка на вход -->
|
||||
<div class="text-center mt-3">
|
||||
<a href="{% url 'accounts:login' %}" class="text-decoration-none">Вспомнили пароль? Войти</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</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 %}
|
||||
9
myproject/accounts/templates/accounts/register.html
Normal file
9
myproject/accounts/templates/accounts/register.html
Normal file
@@ -0,0 +1,9 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block title %}Регистрация{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h2>Регистрация</h2>
|
||||
<p>Форма регистрации доступна на главной странице.</p>
|
||||
<a href="{% url 'index' %}">Перейти на главную</a>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user