Авторизация: форма входа, cookie-сессия, защита /api/* (кроме health/login/me/logout)

This commit is contained in:
2026-08-26 00:38:23 +07:00
parent 5dcc4ce1ad
commit d9eccfb4b7
7 changed files with 482 additions and 17 deletions

View File

@@ -15,7 +15,7 @@
rel="icon"
href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Crect width='64' height='64' rx='16' fill='%23202321'/%3E%3Ctext x='32' y='45' font-size='38' font-weight='bold' text-anchor='middle' fill='%23ffffff' font-family='sans-serif'%3E%D0%9A%3C/text%3E%3C/svg%3E"
>
<link rel="stylesheet" href="/style.css?v=8">
<link rel="stylesheet" href="/style.css?v=9">
</head>
<body>
<header class="topbar">
@@ -24,14 +24,19 @@
<span class="brand-name">Кадр</span>
</a>
<div
id="health-status"
class="health-status health-loading"
role="status"
aria-live="polite"
>
<span class="health-dot" aria-hidden="true"></span>
<span id="health-text">Проверяем сервер обработки…</span>
<div class="topbar-right">
<div
id="health-status"
class="health-status health-loading"
role="status"
aria-live="polite"
>
<span class="health-dot" aria-hidden="true"></span>
<span id="health-text">Проверяем сервер обработки…</span>
</div>
<button id="logout-button" class="logout-button" type="button" hidden>
Выйти
</button>
</div>
</header>
@@ -230,12 +235,32 @@
</section>
</main>
<div id="auth-overlay" class="auth-overlay" role="dialog" aria-modal="true" aria-labelledby="auth-title">
<form id="login-form" class="auth-card" novalidate>
<p class="auth-eyebrow">Закрытый доступ</p>
<h1 id="auth-title">Вход в редактор</h1>
<p class="auth-lead">Редактор доступен только владельцу. Войдите, чтобы продолжить.</p>
<div class="auth-field">
<label class="field-label" for="login-username">Логин</label>
<input id="login-username" name="username" type="text" autocomplete="username" autofocus required>
</div>
<div class="auth-field">
<label class="field-label" for="login-password">Пароль</label>
<input id="login-password" name="password" type="password" autocomplete="current-password" required>
</div>
<p id="login-error" class="auth-error" hidden></p>
<button id="login-submit" class="button button-primary auth-submit" type="submit">
<span>Войти</span>
</button>
</form>
</div>
<noscript>
<div class="noscript">
Для работы редактора необходимо включить JavaScript.
</div>
</noscript>
<script src="/app.js?v=8" defer></script>
<script src="/app.js?v=9" defer></script>
</body>
</html>