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 <noreply@anthropic.com>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user