-
Notifications
You must be signed in to change notification settings - Fork 0
Admin Lockout
DredBaron edited this page Jun 6, 2026
·
5 revisions
If you are locked out of your admin account, you can reset the password directly against the database. This requires access to the host machine running OpenMTG.
export $(grep -v '^#' .env | xargs)docker compose exec db psql -U $POSTGRES_USER $POSTGRES_DB -c "SELECT id, username, is_admin, is_active FROM users;"Note the exact username, case-sensitive.
docker compose run --rm --no-deps app python3 -c "import bcrypt; print(bcrypt.hashpw(b'NEWPASSWORD', bcrypt.gensalt()).decode())"Replace yournewpassword with the new password. The output will look like:
$2b$12$somehashedstringhere...
docker compose exec db psql -U $POSTGRES_USER $POSTGRES_DB -c "UPDATE users SET hashed_password = '\$2b\$12\$HASHEDSTRINGHERE' WHERE username = 'admin';"Replace $HASHEDSTRINGHERE with the full string output by the bcrypt command.
The terminal should report UPDATE 1. The \$ escaping is required when passing the hash on the command line.
Use the username from step 2 and the new password. No restart is required.