- ZIP download from the Merkzettel: every photo is a new usage by
default; only already downloaded photos offer "Neu / Bereits genutzt"
(SegmentedControl), with thumbnails and a cost summary. "Bild
auslassen" is gone.
- Toasts (Sakani Toaster) for admin saves, deletes and errors; billing
errors are readable and use router.refresh instead of reloads. Errors
inside modal dialogs stay inline (a toast would sit behind the
backdrop).
- Album overview in blog-listing style, Sakani Pagination for albums,
search and usage history, skeleton loading states.
- Registration stepper; verification mail lands on step 3.
- Editorials as a searchable, filterable table; audit log with event
picker, German labels and collapsible details.
- Release notes 2.4.0 seeded (migration 0009).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Implements OWASP audit recommendations P1-P3:
P1 - Two-factor authentication (TOTP) mandatory for admins:
- better-auth twoFactor plugin; new two_factor table + user flag
(migration 0010, MUST run before deploying the app)
- requireAdmin throws TWO_FACTOR_REQUIRED without a finished setup;
pages redirect to the new /zwei-faktor wizard which uses a weak
guard (allowWithoutTwoFactor) so admins can never lock themselves
out. Wizard lives outside /admin to avoid layout redirect loops.
- login flow handles twoFactorRedirect and asks for the TOTP code;
backup codes are shown once during enablement
P2 - Step-up for destructive operations (ASVS 2.5.4):
- hardDeleteEditorialAction and resetUsageDataAction reject sessions
older than 15 minutes (SESSION_STALE) with actionable German
messages instead of throwing opaque digests
P3 - Password policy (NIST 800-63B):
- minimum length raised from 8 to 12 plus common-password denylist,
enforced for registration AND reset/change via a before-hook
Better Auth's parseUserOutput filters the session user to declared fields
only (filterOutputFields over getFields(options,'user','output')). The drizzle
adapter selects the custom `role` column, but because it was never declared in
the Better Auth config, parseUserOutput stripped it — session.user.role was
always undefined. That broke two things: the root redirect fell through to
/redaktion/alben for admins (role !== 'ADMIN'), and requireAdmin threw
ADMIN_REQUIRED on every /admin page (role !== 'ADMIN').
Declare role via user.additionalFields (the documented custom-field API; the
`fields` map only renames core columns). input:false keeps it unsettable on
signUp — the DB default and the admin seed own it — and defaultValue matches
the column default so inserts never send null into the NOT NULL portalRole enum.
Co-Authored-By: Claude <noreply@anthropic.com>
Better Auth's default id generator emits a nanoid-style string, but
every id column in the schema is typed uuid. Better Auth passes its
generated id explicitly on insert (bypassing the column defaultRandom),
so Postgres rejected every signUp/session/verification insert with
'invalid input syntax for type uuid'. This broke live registration and
the admin seed alike. Configure advanced.database.generateId to return
crypto.randomUUID() so ids match the schema.
Co-Authored-By: Claude <noreply@anthropic.com>