fix(ente): emails are encrypted in DB, query first user_id instead

Museum encrypts emails before storing (encrypted_email column).
Cannot query by plaintext email. Instead select the first user_id
which is the admin user created during first-start setup.
This commit is contained in:
CanbiZ (MickLesk)
2026-03-27 16:02:02 +01:00
parent f3b9feba2a
commit 93015c3b55

View File

@@ -357,9 +357,9 @@ fi
DB_NAME="$(grep -A4 '^db:' /opt/ente/server/museum.yaml | awk '/name:/{print $2}')" DB_NAME="$(grep -A4 '^db:' /opt/ente/server/museum.yaml | awk '/name:/{print $2}')"
DB_PASS="$(grep -A5 '^db:' /opt/ente/server/museum.yaml | awk '/password:/{print $2}')" DB_PASS="$(grep -A5 '^db:' /opt/ente/server/museum.yaml | awk '/password:/{print $2}')"
USER_ID=$(PGPASSWORD="$DB_PASS" psql -h 127.0.0.1 -U ente -d "$DB_NAME" -tAc "SELECT user_id FROM users WHERE email='$EMAIL' LIMIT 1;") USER_ID=$(PGPASSWORD="$DB_PASS" psql -h 127.0.0.1 -U ente -d "$DB_NAME" -tAc "SELECT user_id FROM users ORDER BY user_id LIMIT 1;")
if [ -z "$USER_ID" ]; then if [ -z "$USER_ID" ]; then
echo "Error: No user found with email $EMAIL" echo "Error: No users found in database."
echo "Make sure you created and verified the account via the web UI first." echo "Make sure you created and verified the account via the web UI first."
exit 1 exit 1
fi fi