Skip to content

Add user login, app header, and dynamic token auth#3

Open
florianholtgrefe wants to merge 4 commits into
mainfrom
feature/user-login
Open

Add user login, app header, and dynamic token auth#3
florianholtgrefe wants to merge 4 commits into
mainfrom
feature/user-login

Conversation

@florianholtgrefe

Copy link
Copy Markdown
Owner

Summary

  • Login-Seite: Formular mit Benutzername + Passwort, authentifiziert gegen POST /api/token/ des paperless-Backends. Kein eigener Benutzerspeicher — es gelten die paperless-Accounts.
  • Session: Token + Benutzerdaten werden in localStorage gespeichert. authStore (Svelte 5 runes) steuert den Login-Zustand über Sessions hinweg.
  • App-Header: Zeile oberhalb des Inhalts mit zentrierter Suchleiste (Dummy), Notifications-Icon (Dummy) und Benutzermenü (Avatar-Initialen, Name, Abmelden).
  • Abmelden: Dropdown im Header → „Abmelden" löscht Token + User aus localStorage, leitet zur Login-Seite weiter.
  • Dynamisches Token: authHeader() in api/client.ts liest den Token jetzt aus localStorage statt aus einer statischen Env-Variable — kein VITE_PAPERLESS_TOKEN mehr nötig.

Test plan

  • App öffnen → Login-Seite erscheint
  • Falsches Passwort → Fehlermeldung
  • Korrektes Login → App öffnet sich, Header zeigt Benutzernamen
  • Seite neu laden → bleibt eingeloggt (localStorage)
  • Abmelden → zurück zur Login-Seite

🤖 Generated with Claude Code

florianholtgrefe and others added 4 commits June 14, 2026 10:21
- LoginView: form posts to POST /api/token/, fetches user from /api/ui_settings/,
  stores token + user in localStorage — no static env token needed
- authStore: Svelte 5 runes store, reads/writes localStorage, exposes isLoggedIn
- AppHeader: search bar (dummy), notifications icon, user avatar + name,
  dropdown menu with logout
- Layout: gate entire app behind authStore.isLoggedIn, shows LoginView otherwise
- api/client.ts: authHeader() reads token from localStorage dynamically

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Dockerfile: two-stage build (node:22 build + nginx:alpine serve)
- nginx.conf: serves static build, proxies /api/ and /share/ to
  paperless-ngx on internal Docker network (http://paperless-ngx:8000)
- CSP: script-src 'self' blocks XSS script injection; style-src allows
  unsafe-inline for Svelte's dynamic tag color styles; frame-src/img-src
  allow blob: for PDF viewer and thumbnails; frame-ancestors 'none'
- Additional headers: X-Content-Type-Options, X-Frame-Options, Referrer-Policy
- adapter-static: fallback: 'index.html' for SPA routing

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant