trails/packages
Ullrich Schäfer f16e80a2eb
Prompt users with stale terms_version to re-accept
The three pre-legal-disclaimer users (ullrich, pistazie, nelli) have
NULL terms_version, and any future Terms update would leave every
existing user in the same state. Close the loop now that we have
version storage by redirecting any logged-in user whose
users.terms_version doesn't match the currently-published
TERMS_VERSION to a dedicated acceptance page.

Changes:
- auth.server: new recordTermsAcceptance(userId, version) helper that
  writes both terms_accepted_at and terms_version.
- root loader: if the session user has a stale or NULL terms_version,
  throw redirect("/auth/accept-terms?returnTo=<pathname>") unless the
  request is already on an allow-listed path
  (/auth/accept-terms, /auth/logout, /legal/*) so Terms are reachable
  and logout works.
- New route /auth/accept-terms (GET renders the prompt, POST records
  acceptance and bounces to a sanitised returnTo). Same-origin check
  on returnTo to avoid open-redirect abuse. Logout button is provided
  as an escape hatch.
- i18n: new auth.reaccept.* keys for EN and DE.
- Spec: new Requirement + five scenarios (redirect, allow-list,
  successful re-accept, missing consent, returnTo sanitisation).

No action on the three legacy users is required beyond what they'll
experience on their next visit — the gate takes care of it.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-19 08:06:16 +02:00
..
api Standardize monorepo pipeline: test, lint, typecheck across all workspaces 2026-04-13 00:00:43 +02:00
db Store Terms version alongside acceptance timestamp 2026-04-19 07:46:34 +02:00
gpx Standardize monorepo pipeline: test, lint, typecheck across all workspaces 2026-04-13 00:00:43 +02:00
i18n Prompt users with stale terms_version to re-accept 2026-04-19 08:06:16 +02:00
jobs Fix pg-boss queue creation before work registration 2026-04-14 09:08:19 +02:00
map Add tests to all packages, remove passWithNoTests 2026-04-13 00:48:27 +02:00
map-core Add tests to all packages, remove passWithNoTests 2026-04-13 00:48:27 +02:00
sentry-config Fix sentry-config typecheck: explicit types: [node] in tsconfig 2026-04-18 00:43:48 +02:00
types Standardize monorepo pipeline: test, lint, typecheck across all workspaces 2026-04-13 00:00:43 +02:00
ui Add tests to all packages, remove passWithNoTests 2026-04-13 00:48:27 +02:00