feat(admin): gate the backoffice behind a name and password

- ui/auth.js: name/password check, session kept in sessionStorage (new tab asks again),
  5 wrong attempts lock the form for 30s
- admin view renders a login card until authenticated; adds an explicit logout button
- SW precache includes auth.js, version bumped to 2026.11.19.3 (meta + sw.js in sync)
- docs: AGENTS.md notes the gate is client-side; real protection is the server ADMIN_TOKEN
This commit is contained in:
Bkk1234 committed 2026-11-19 11:28:20 +07:00
1 parent 79b147d38f
commit cd5cb5dd08
6 files changed
+208 -3

No files matched your search

+58
View File
@@ -51,6 +51,64 @@
padding: var(--space-5);
}
/* ------------------------------------------------------------- auth */
.auth-wrap {
display: grid;
place-items: center;
min-height: min(72vh, 720px);
padding-block: var(--space-6);
}
.auth-card {
width: min(430px, 100%);
padding: var(--space-8) var(--space-6) var(--space-6);
border: 1px solid var(--border);
border-radius: var(--radius-xl);
background: linear-gradient(180deg, #fff 0%, var(--brand-50) 100%);
box-shadow: var(--shadow-md);
text-align: center;
}
.auth-card__icon {
display: inline-grid;
place-items: center;
width: 52px;
height: 52px;
border-radius: 16px;
background: #fff;
border: 1px solid var(--brand-200);
color: var(--brand-700);
margin-bottom: var(--space-4);
}
.auth-card__icon svg {
width: 26px;
height: 26px;
}
.auth-card__title {
font-size: 1.35rem;
}
.auth-card__sub {
margin-top: 6px;
font-size: 14.5px;
color: var(--muted-foreground);
}
.auth-card form {
margin-top: var(--space-5);
text-align: start;
}
.auth-card .field + .field {
margin-top: var(--space-4);
}
.auth-card .field__error {
margin-top: var(--space-2);
min-height: 0;
}
.auth-card__submit {
width: 100%;
margin-top: var(--space-4);
}
.auth-card .admin-hint {
text-align: center;
}
/* ------------------------------------------------------------- fields */
.field {
display: flex;