fix(setup): address PR #714 review — password UX, script token, race, nits

Blockers:
- SetupPage now mirrors the server password rule (>=8 with upper/lower/digit) so
  a green client isn't bounced by the server; server errors carry a `field`
  (routes/setup.js) that the client maps to a translated key instead of
  rendering raw English. New i18n: setup.invalidToken, setup.passwordRequirements.
- picpeak-setup.sh: the ADMIN_CREDENTIALS.txt block no longer dead-ends on the
  wizard path — when no legacy admin was seeded it prints the one-time setup
  token (from data/SETUP_TOKEN / docker compose logs) and points at /setup.

Concern:
- createInitialAdmin creates the admin + burns the token in ONE transaction,
  atomically claiming the token (null-if-present, expect 1 row) so a
  double-submit can't create two super_admins. Cross-DB (whereNotNull, trx-only
  writes). Added a concurrency test.

Nits:
- SetupPage redirects to /login when /setup/status errors (no form flash on a
  configured instance).
- Dropped the unused DATABASE_URL from docker-compose.yml.
- Documented why secrets are chmod 644 (three different reader users).
This commit is contained in:
Luca
2026-07-02 13:21:55 +02:00
parent 415bffa04c
commit 286975dc52
9 changed files with 110 additions and 38 deletions
+2
View File
@@ -3470,6 +3470,8 @@
"tokenHint": "Wird beim ersten Start in den Server-Logs ausgegeben (auch in data/SETUP_TOKEN gespeichert).",
"tokenRequired": "Der Setup-Token ist erforderlich",
"tokenLocationHint": "Nicht gefunden? Führen Sie aus: docker compose logs backend | grep -i \"setup token\"",
"invalidToken": "Dieser Setup-Token ist ungültig.",
"passwordRequirements": "Verwenden Sie mindestens 8 Zeichen mit einem Groß- und einem Kleinbuchstaben sowie einer Ziffer.",
"emailLabel": "E-Mail-Adresse",
"emailPlaceholder": "[email protected]",
"emailRequired": "E-Mail ist erforderlich",
+2
View File
@@ -3366,6 +3366,8 @@
"tokenHint": "Printed to the server logs on first start (also saved to data/SETUP_TOKEN).",
"tokenRequired": "The setup token is required",
"tokenLocationHint": "Can't find it? Run: docker compose logs backend | grep -i \"setup token\"",
"invalidToken": "That setup token is not valid.",
"passwordRequirements": "Use at least 8 characters with an upper-case letter, a lower-case letter and a number.",
"emailLabel": "Email address",
"emailPlaceholder": "[email protected]",
"emailRequired": "Email is required",