Commit Graph

14 Commits

Author SHA1 Message Date
XPS\Micro
ff22add424 fix: wrap useSearchParams in Suspense boundary for verify pages
- Extract VerifySignupContent and VerifyLoginContent components
- Wrap components in Suspense boundary to avoid static generation errors
- Add loading spinner fallback during hydration
- Fixes 'useSearchParams() should be wrapped in a suspense boundary' error in Next.js 14
2026-01-31 17:44:51 +01:00
XPS\Micro
13082f97b1 fix: handle undefined last_used in formatDate
- Update formatDate() to accept string | null | undefined
- Fixes TypeScript error for optional last_used field in AdminUser
- Returns '-' if date is not available (null or undefined)
2026-01-31 17:31:13 +01:00
XPS\Micro
b116d74f84 fix: remove username references from admin page
- Replace u.username with u.slug in search filter
- Replace user display names from username to email (primary identifier in passwordless auth)
- Update avatar fallbacks to use email initials
- Update handleDeleteUser parameter from username to userEmail
- Align admin page with new user identification scheme
2026-01-31 17:00:40 +01:00
XPS\Micro
fe4907ee46 fix: update admin page for passwordless authentication
- Remove handleResetPassword function (no longer needed with Magic Links)
- Change password reset button to send Magic Link instead
- Update button icon from KeyRound to Mail
- Update button tooltip to reflect new Magic Link flow
- Remove unused KeyRound import
2026-01-31 16:46:45 +01:00
XPS\Micro
20a0f3d6af feat: Implement passwordless authentication with Magic Links
Major changes:
- Remove username and password_hash from User model
- Add MagicLinkToken table for one-time-use email authentication
- Implement Magic Link email sending with 15-minute expiration
- Update all auth endpoints (/login, /signup) to use email only
- Create verify-signup and verify-login pages for token verification
- Container URLs now use slug instead of username (e.g., /u-a3f9c2d1)
- Add rate limiting: max 3 Magic Links per email per hour
- Remove password reset functionality (no passwords to reset)

Backend changes:
- api.py: Complete rewrite of auth routes (magic link based)
- models.py: Remove username/password, add slug and MagicLinkToken
- email_service.py: Add Magic Link generation and email sending
- admin_api.py: Remove password reset, update to use email identifiers
- container_manager.py: Use slug instead of username for routing
- config.py: Add MAGIC_LINK_TOKEN_EXPIRY and MAGIC_LINK_RATE_LIMIT

Frontend changes:
- src/lib/api.ts: Update auth functions and User interface
- src/hooks/use-auth.tsx: Implement verifySignup/verifyLogin
- src/app/login/page.tsx: Email-only login form
- src/app/signup/page.tsx: Email-only signup form
- src/app/verify-signup/page.tsx: NEW - Signup token verification
- src/app/verify-login/page.tsx: NEW - Login token verification
- src/app/dashboard/page.tsx: Display slug instead of username

Infrastructure:
- install.sh: Simplified, no migration needed (db.create_all handles it)
- .env.example: Add MAGIC_LINK_TOKEN_EXPIRY and MAGIC_LINK_RATE_LIMIT
- Add IMPLEMENTATION-GUIDE.md with detailed setup instructions

Security improvements:
- No password storage = no password breaches
- One-time-use tokens prevent replay attacks
- 15-minute token expiration limits attack window
- Rate limiting prevents email flooding

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-01-31 16:19:22 +01:00
XPS\Micro
67149e1544 fix: install curl in frontend Dockerfile for healthcheck compatibility
- Added curl installation in Debian slim runner stage
- curl is required for healthcheck in docker-compose.yml
- curl is pre-installed in node:20-slim base image was incorrect assumption
- Healthcheck uses: curl -f http://localhost:3000/
- Cleaned up apt cache to keep image size minimal
2026-01-31 13:34:51 +01:00
XPS\Micro
29145dde84 fix: switch from Alpine to Debian slim Node.js image to resolve SWC binary loading issue
- Changed FROM node:20-alpine to node:20-slim for both builder and runner stages
- Alpine (musl) is incompatible with Next.js SWC binary (glibc)
- Debian slim provides 80% smaller image compared to full node:20 (~180MB vs ~900MB)
- Fully compatible with Next.js and SWC without any patches
- Better performance and stability on Synology NAS
2026-01-31 12:39:31 +01:00
XPS\Micro
4b8cd3eb4a fix: email verification improvements
- FRONTEND_URL now generates correct URL from BASE_DOMAIN and SPAWNER_SUBDOMAIN
- Fixed German umlaut in email button: 'bestaetigen' → 'bestätigen'
- Added 'verified=true' parameter to backend redirect for hybrid approach
- Frontend now checks 'verified' parameter and shows error if not set
- Removed unused token logic from verify-success page (backend handles verification)
- Added warning UI for unverified emails with resend link
2026-01-31 11:57:52 +01:00
XPS\Micro
63a396955e fix: wrap useSearchParams in Suspense boundary for Next.js 14 compatibility
- Added Suspense boundary to verify-success/page.tsx
- Added Suspense boundary to verify-error/page.tsx
- Fixes build error: useSearchParams() should be wrapped in a suspense boundary
- Added Loader2 fallback UI for both pages
2026-01-31 10:46:58 +01:00
XPS\Micro
d188115db4 Add admin features and email verification
Backend:
- First registered user becomes admin automatically
- Email verification required before login
- Admin API with user management endpoints:
  - Block/unblock users
  - Reset passwords (sends email)
  - Delete user containers
  - Delete users
  - Resend verification emails
  - Takeover sessions (Phase 2 dummy)
- New decorators: @admin_required, @verified_required
- SMTP configuration for email sending
- UserState enum (registered/verified/active)
- Activity tracking (last_used field)

Frontend:
- Admin dashboard with color-coded user list
  - Green: active, recently used
  - Yellow: warning (unverified/inactive)
  - Red: critical (long unverified/very long inactive)
- Email verification flow (verify-success/verify-error pages)
- Signup shows verification instructions
- Login handles unverified accounts with resend option
- Admin link in dashboard header for admins

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 07:01:51 +01:00
XPS\Micro
d4af469207 Fix Dockerfiles: use npm install if package-lock.json missing 2026-01-30 23:14:30 +01:00
XPS\Micro
e17231eb75 Add missing frontend/src/lib files (api.ts, utils.ts) 2026-01-30 22:00:55 +01:00
XPS\Micro
c80d3c0d92 Script modified 2026-01-30 21:45:27 +01:00
XPS\Micro
c363351483 Initial project structure with documentation 2026-01-30 18:00:41 +01:00