Add multi-user authentication with JWT

- Users table with email/bcrypt-hashed password; register and login via /auth/ endpoints
- JWT tokens (30-day expiry) stored in localStorage; all API routes require Bearer auth
- All data (varieties, batches, settings, notification logs) scoped to the authenticated user
- Login/register screen overlays the app; sidebar shows user email and logout button
- Scheduler sends daily ntfy summaries for every configured user
- DB schema rewritten for multi-user; SECRET_KEY added to env

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-09 00:08:28 -07:00
parent 1bed02ebb5
commit 4db9988406
17 changed files with 470 additions and 115 deletions

View File

@@ -634,3 +634,50 @@ a:hover { text-decoration: underline; }
.auth-toggle { display: flex; gap: 1.25rem; flex-wrap: wrap; }
.auth-toggle-option { display: flex; align-items: center; gap: 0.35rem; cursor: pointer; font-size: 0.9rem; }
.auth-toggle-option input[type="radio"] { accent-color: var(--green-mid); }
/* ===== Auth Screen ===== */
.auth-overlay {
position: fixed; inset: 0; z-index: 1000;
background: linear-gradient(135deg, #d8f3dc 0%, #b7e4c7 50%, #95d5b2 100%);
display: flex; align-items: center; justify-content: center;
padding: 1rem;
}
.auth-card {
background: var(--bg-card); border-radius: 1rem;
box-shadow: 0 8px 32px rgba(0,0,0,0.12);
padding: 2.5rem 2rem; width: 100%; max-width: 400px;
}
.auth-brand {
display: flex; align-items: center; gap: 0.5rem;
justify-content: center; margin-bottom: 2rem;
font-size: 1.6rem; font-weight: 700; color: var(--green-dark);
}
.auth-brand .brand-icon { font-size: 2rem; }
.auth-tabs {
display: flex; margin-bottom: 1.5rem;
border-bottom: 2px solid var(--border);
}
.auth-tab {
flex: 1; padding: 0.6rem; background: none; border: none;
font-size: 0.9rem; font-weight: 500; color: var(--text-light);
cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px;
transition: color 0.2s, border-color 0.2s;
}
.auth-tab.active { color: var(--green-dark); border-bottom-color: var(--green-dark); }
.auth-msg { padding: 0.6rem 0.75rem; border-radius: 0.4rem; font-size: 0.85rem; margin-bottom: 1rem; }
.auth-msg.error { background: #fee2e2; color: #b91c1c; }
.btn-full { width: 100%; justify-content: center; margin-top: 0.5rem; }
/* Sidebar user + logout */
.sidebar-user {
display: block; font-size: 0.75rem; color: var(--text-light);
white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
max-width: 100%; margin-bottom: 0.25rem;
}
.btn-logout {
width: 100%; padding: 0.4rem; margin-top: 0.5rem;
background: none; border: 1px solid var(--border); border-radius: 0.4rem;
color: var(--text-light); font-size: 0.8rem; cursor: pointer;
transition: background 0.15s, color 0.15s;
}
.btn-logout:hover { background: var(--border); color: var(--text); }