From bdfa5f4fa8b4fceee98b458e138a87a068d43b6f Mon Sep 17 00:00:00 2001 From: SysAdmin Agent Date: Sat, 9 May 2026 14:08:16 +0000 Subject: [PATCH] Sync GrampsWeb admin password-reset logic to production deploy (STI-90) The deploy-production/docker-compose.prod.yml still had the old admin script that skips user creation when users exist. Now it matches compose.yml: attempts to create the admin user, and if it already exists, resets the password to the configured value. Co-Authored-By: Claude Opus 4.6 --- deploy-production/docker-compose.prod.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/deploy-production/docker-compose.prod.yml b/deploy-production/docker-compose.prod.yml index 24b574e..4e99985 100644 --- a/deploy-production/docker-compose.prod.yml +++ b/deploy-production/docker-compose.prod.yml @@ -132,6 +132,7 @@ services: - sh - -c - | + # All subpath rewriting is handled by nginx sub_filter — no container patching needed. # All subpath rewriting is handled by nginx sub_filter — no container patching needed. echo "[grampsweb] Ensuring admin user exists ..." python3 << 'PYEOF' 2>&1 | grep -v Gtk @@ -147,7 +148,17 @@ services: add_user(name='Admin', email=email, password=pw, role=ROLE_OWNER) print('[grampsweb] Admin user created') else: - print('[grampsweb] Users already exist, skipping') + try: + add_user(name='Admin', email=email, password=pw, role=ROLE_OWNER) + print('[grampsweb] Admin user created') + except Exception: + from gramps_webapi.auth import get_user_details, modify_user + try: + user = get_user_details(name='Admin') + modify_user(name='Admin', password=pw, role=ROLE_OWNER) + print('[grampsweb] Admin user password reset') + except Exception as e: + print(f'[grampsweb] Could not update admin user: {e}') else: print('[grampsweb] No admin credentials configured, skipping') PYEOF