README.md

This commit is contained in:
2026-09-06 17:32:29 +03:00
parent 216da22bc2
commit 7ae77c0775
16 changed files with 811 additions and 56 deletions
+5
View File
@@ -170,6 +170,7 @@
<tr>
<th>ID</th>
<th>Имя пользователя</th>
<th>Email</th>
<th>Роль</th>
<th>Создан</th>
<th>Последний вход</th>
@@ -182,6 +183,7 @@
<tr>
<td>{{ user.id }}</td>
<td><strong>{{ user.username }}</strong></td>
<td>{{ user.email or '-' }}</td>
<td>
<form action="{{ url_for('admin_change_role', user_id=user.id) }}" method="POST"
class="d-flex">
@@ -227,6 +229,9 @@
</table>
</div>
</div>
</div>
<div class="card mt-4">
+12 -14
View File
@@ -14,23 +14,17 @@
<input type="hidden" name="csrf_token" value="{{ csrf_token }}">
<div class="mb-3">
<label for="username" class="form-label">Логин</label>
<label for="username" class="form-label">Логин <span class="text-danger">*</span></label>
<input type="text" class="form-control" id="username" name="username"
placeholder="Введите логин (минимум 3 символа)" required minlength="3">
<div class="form-text text-secondary">Только буквы, цифры и знак подчеркивания</div>
</div>
<div class="mb-3">
<label for="password" class="form-label">Пароль</label>
<input type="password" class="form-control" id="password" name="password"
placeholder="Введите пароль (минимум 6 символов)" required minlength="6">
<div class="form-text text-secondary">Минимум 6 символов</div>
</div>
<div class="mb-3">
<label for="confirm_password" class="form-label">Подтверждение пароля</label>
<input type="password" class="form-control" id="confirm_password" name="confirm_password"
placeholder="Повторите пароль" required>
<label for="email" class="form-label">Email <span class="text-danger">*</span></label>
<input type="email" class="form-control" id="email" name="email"
placeholder="user@example.com" required>
<div class="form-text text-secondary">На этот адрес будет отправлен пароль</div>
</div>
<div class="mb-3">
@@ -39,9 +33,13 @@
<option value="user">Пользователь</option>
<option value="admin">Администратор</option>
</select>
<div class="form-text text-secondary">Администратор может управлять пользователями и просматривать логи
секретов.
</div>
<div class="form-text text-secondary">Администратор может управлять пользователями и просматривать логи секретов.</div>
</div>
<div class="alert alert-secondary">
<i class="bi bi-info-circle me-2"></i>
<strong>Пароль будет сгенерирован автоматически</strong> и отправлен на указанный email
в виде секретной ссылки для безопасной передачи.
</div>
<button type="submit" class="btn btn-secondary w-100">Создать пользователя</button>
+6 -2
View File
@@ -35,7 +35,9 @@
<a href="{{ url_for('admin_panel') }}" class="btn btn-sm btn-secondary">Админка</a>
{% endif %}
<span class="text-secondary small mx-1">|</span>
<span class="text-secondary small me-1">{{ current_user }}</span>
<a href="{{ url_for('profile') }}" class="text-decoration-none text-secondary small me-1">
<i class="bi bi-person-circle"></i> {{ current_user }}
</a>
<a href="{{ url_for('logout') }}" class="btn btn-sm btn-outline-danger">Выйти</a>
{% else %}
<a href="{{ url_for('login') }}" class="btn btn-sm btn-secondary">Войти</a>
@@ -57,7 +59,9 @@
{% block content %}{% endblock %}
<footer class="pt-3 mt-4 border-top text-center text-secondary">
<small><a href="https://git.palchikov.name/PalchikovAleksandr/secrettext" class="link-secondary link-offset-2 link-underline-opacity-25 link-underline-opacity-100-hover">Проект с открытым исходным кодом secrettext</a></small>
<small><a href="https://git.palchikov.name/PalchikovAleksandr/secrettext"
class="link-secondary link-offset-2 link-underline-opacity-25 link-underline-opacity-100-hover">Проект
с открытым исходным кодом secrettext</a></small>
</footer>
</div>
+38
View File
@@ -0,0 +1,38 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>{% block title %}SecretText{% endblock %}</title>
</head>
<body style="margin: 0; padding: 0; font-family: 'Courier New', monospace; background-color: #fafafa;">
<table width="100%" cellpadding="0" cellspacing="0" border="0" style="background-color: #fafafa; padding: 30px 0;">
<tr>
<td align="center">
<table width="480" cellpadding="0" cellspacing="0" border="0" style="width: 480px; background-color: #ffffff; border: 1px solid #cccccc;">
<tr>
<td style="padding: 20px 30px 14px 30px; border-bottom: 1px solid #cccccc; text-align: center;">
<span style="font-size: 16px; font-weight: 700; color: #000000; letter-spacing: 3px;">SECRETTEXT</span>
</td>
</tr>
<tr>
<td style="padding: 24px 30px 20px 30px;">
{% block content %}{% endblock %}
</td>
</tr>
<tr>
<td style="padding: 10px 30px 16px 30px; border-top: 1px solid #dddddd; text-align: center; font-size: 11px; color: #999999;">
SecretText
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
+21
View File
@@ -0,0 +1,21 @@
{% extends "emails/base_email.html" %}
{% block content %}
<div style="font-size: 14px; line-height: 1.6; color: #333333; margin-bottom: 16px;">
Кто-то отправил вам секрет.
</div>
<div style="text-align: center; margin: 16px 0 14px 0;">
<a href="{{ base_url }}/my-secrets" style="display: inline-block; padding: 10px 28px; background-color: #000000; color: #ffffff; text-decoration: none; font-size: 13px; font-weight: 600; letter-spacing: 1px;">МОИ СЕКРЕТЫ</a>
</div>
<div style="font-size: 11px; color: #888888; text-align: center; word-break: break-all; margin-bottom: 14px;">
{{ base_url }}/my-secrets
</div>
<div style="font-size: 11px; color: #666666; border-top: 1px solid #dddddd; padding-top: 12px; margin-top: 8px; line-height: 1.5;">
Секрет доступен для одноразового просмотра.
</div>
{% endblock %}
+27
View File
@@ -0,0 +1,27 @@
{% extends "emails/base_email.html" %}
{% block content %}
<div style="font-size: 14px; line-height: 1.6; color: #333333; margin-bottom: 16px;">
Вам отправили секрет по запросу.
</div>
{% if note %}
<div style="background-color: #f4f4f4; padding: 10px 14px; font-size: 13px; color: #666666; margin-bottom: 18px; border: 1px solid #dddddd;">
Примечание: {{ note }}
</div>
{% endif %}
<div style="text-align: center; margin: 16px 0 14px 0;">
<a href="{{ base_url }}/my-secrets" style="display: inline-block; padding: 10px 28px; background-color: #000000; color: #ffffff; text-decoration: none; font-size: 13px; font-weight: 600; letter-spacing: 1px;">МОИ СЕКРЕТЫ</a>
</div>
<div style="font-size: 11px; color: #888888; text-align: center; word-break: break-all; margin-bottom: 14px;">
{{ base_url }}/my-secrets
</div>
<div style="font-size: 11px; color: #666666; border-top: 1px solid #dddddd; padding-top: 12px; margin-top: 8px; line-height: 1.5;">
Секрет доступен для одноразового просмотра.
</div>
{% endblock %}
+17
View File
@@ -0,0 +1,17 @@
{% extends "emails/base_email.html" %}
{% block content %}
<div style="font-size: 14px; line-height: 1.6; color: #333333; margin-bottom: 16px;">
Ваш секрет был просмотрен.
</div>
<div style="text-align: center; margin: 16px 0 14px 0;">
<a href="{{ base_url }}" style="display: inline-block; padding: 10px 28px; background-color: #000000; color: #ffffff; text-decoration: none; font-size: 13px; font-weight: 600; letter-spacing: 1px;">СОЗДАТЬ НОВЫЙ</a>
</div>
<div style="font-size: 11px; color: #888888; text-align: center; word-break: break-all;">
{{ base_url }}
</div>
{% endblock %}
+29
View File
@@ -0,0 +1,29 @@
{% extends "emails/base_email.html" %}
{% block content %}
<div style="font-size: 14px; line-height: 1.6; color: #333333; margin-bottom: 16px;">
Для вас создан аккаунт в SecretText.
</div>
<div style="background-color: #f4f4f4; padding: 10px 14px; font-size: 14px; color: #000000; margin-bottom: 18px; border: 1px solid #dddddd;">
Логин: <span style="font-weight: 700;">{{ username }}</span>
</div>
<div style="font-size: 13px; color: #333333; margin-bottom: 10px;">
Ссылка для получения пароля:
</div>
<div style="text-align: center; margin: 16px 0 14px 0;">
<a href="{{ view_url }}" style="display: inline-block; padding: 10px 28px; background-color: #000000; color: #ffffff; text-decoration: none; font-size: 13px; font-weight: 600; letter-spacing: 1px;">ПОЛУЧИТЬ ПАРОЛЬ</a>
</div>
<div style="font-size: 11px; color: #888888; text-align: center; word-break: break-all; margin-bottom: 14px;">
{{ view_url }}
</div>
<div style="font-size: 11px; color: #666666; border-top: 1px solid #dddddd; padding-top: 12px; margin-top: 8px; line-height: 1.5;">
Ссылка действительна 24 часа.
</div>
{% endblock %}
+10 -2
View File
@@ -8,14 +8,22 @@
<input type="hidden" name="csrf_token" value="{{ csrf_token }}">
<div class="mb-3">
<textarea class="form-control" id="secret" name="secret" rows="6"
placeholder="" required></textarea>
placeholder="Введите ваш секрет..." required></textarea>
<div class="form-text text-secondary">Максимум {{ config.MAX_SECRET_LENGTH }} символов. Автоудаление
через 24 часа или после просмотра.
</div>
</div>
<!-- НОВОЕ: поле для примечания -->
<div class="mb-3">
<label for="user_note" class="form-label">Примечание (только для вас)</label>
<input type="text" class="form-control" id="user_note" name="user_note"
placeholder="" maxlength="500">
<div class="form-text text-secondary">Не обязательно.</div>
</div>
<button type="submit" class="btn btn-secondary w-100">Создать ссылку</button>
</form>
</div>
</div>
{% endblock %}
+2 -2
View File
@@ -8,7 +8,7 @@
<div class="card">
<div class="card-body">
<h4 class="card-title text-center mb-4">Вход в систему</h4>
<p class="text-secondary text-center mb-3">Войдите под своей учётной записью</p>
<form method="POST" action="{{ url_for('login') }}">
<input type="hidden" name="csrf_token" value="{{ csrf_token }}">
<div class="mb-3">
@@ -22,7 +22,7 @@
<button type="submit" class="btn btn-secondary w-100">Войти</button>
</form>
<div class="text-center mt-3">
<span class="text-secondary small">Если у вас нет аккаунта, обратитесь к администратору</span>
</div>
</div>
</div>
+127
View File
@@ -0,0 +1,127 @@
{% extends "base.html" %}
{% block title %}Профиль пользователя{% endblock %}
{% block content %}
<div class="row">
<div class="col-lg-4">
<div class="card">
<div class="card-body text-center">
<div class="mb-3">
</div>
<h5 class="mb-1">{{ user.username }}</h5>
<p class="text-muted small">Роль: {{ user.role }}</p>
<div class="d-flex justify-content-center gap-3 mb-3">
{% if user.is_active %}
<span class="badge bg-success">Активен</span>
{% else %}
<span class="badge bg-danger">Деактивирован</span>
{% endif %}
</div>
<div class="text-start small text-muted">
<div class="mb-1"><i class="bi me-2"></i>Регистрация: {{ user.created_at|format_datetime }}</div>
<div class="mb-1"><i class="bi me-2"></i>Последний вход: {{ user.last_login|format_datetime or 'Никогда' }}</div>
{% if user.updated_at %}
<div><i class="bi me-2"></i>Обновлен: {{ user.updated_at|format_datetime }}</div>
{% endif %}
</div>
</div>
</div>
</div>
<div class="col-lg-8">
<div class="card">
<div class="card-header">
<ul class="nav nav-tabs card-header-tabs" id="profileTabs" role="tablist">
<li class="nav-item">
<button class="nav-link active" id="info-tab" data-bs-toggle="tab"
data-bs-target="#info" type="button" role="tab">
<i class="bi me-1"></i>Личные данные
</button>
</li>
<li class="nav-item">
<button class="nav-link" id="password-tab" data-bs-toggle="tab"
data-bs-target="#password" type="button" role="tab">
<i class="bi me-1"></i>Смена пароля
</button>
</li>
</ul>
</div>
<div class="card-body">
<div class="tab-content">
<!-- Вкладка "Личные данные" -->
<div class="tab-pane fade show active" id="info" role="tabpanel">
<form method="POST" action="{{ url_for('profile') }}">
<input type="hidden" name="csrf_token" value="{{ csrf_token }}">
<div class="mb-3">
<label for="email" class="form-label">Email</label>
<input type="email" class="form-control" id="email" name="email"
value="{{ user.email or '' }}" placeholder="user@example.com">
</div>
<hr>
<h6 class="mb-3">Настройки уведомлений</h6>
<div class="mb-3">
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" id="notify_email"
name="notify_email" {% if user.notify_email %}checked{% endif %}>
<label class="form-check-label" for="notify_email">
<i class="bi me-1"></i>Уведомления на email
</label>
</div>
</div>
<button type="submit" class="btn btn-secondary w-100">
<i class="bi me-1"></i>Сохранить изменения
</button>
</form>
</div>
<!-- Вкладка "Смена пароля" -->
<div class="tab-pane fade" id="password" role="tabpanel">
<form method="POST" action="{{ url_for('profile_change_password') }}">
<input type="hidden" name="csrf_token" value="{{ csrf_token }}">
<div class="alert alert-secondary">
<i class="bi me-2"></i>Для безопасности используйте сложный пароль (не менее 8 символов,
с буквами разного регистра и цифрами)
</div>
<div class="mb-3">
<label for="old_password" class="form-label">Текущий пароль</label>
<input type="password" class="form-control" id="old_password"
name="old_password" required>
</div>
<div class="mb-3">
<label for="new_password" class="form-label">Новый пароль</label>
<input type="password" class="form-control" id="new_password"
name="new_password" required minlength="6">
<div class="form-text">Минимум 6 символов</div>
</div>
<div class="mb-3">
<label for="confirm_password" class="form-label">Подтвердите пароль</label>
<input type="password" class="form-control" id="confirm_password"
name="confirm_password" required>
</div>
<button type="submit" class="btn btn-secondary w-100">
<i class="bi me-1"></i>Сменить пароль
</button>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
{% endblock %}