fix: include is_admin and household_name in get_user_by_callback_token query
CI / test-and-package (push) Successful in 33s

The auto-login route needs these fields to populate the session, but the
query only selected id, username, household_id. Added JOIN with
households table and selected is_admin + household_name.
This commit is contained in:
agentbox
2026-08-01 06:52:27 +00:00
parent 09eda19fc4
commit 0170786fd3
+3 -1
View File
@@ -233,7 +233,9 @@ def get_user_by_callback_token(token: str) -> dict | None:
"""Look up a user by their ntfy callback token."""
with get_db() as db:
row = db.execute(
"SELECT id, username, household_id FROM users WHERE callback_token = ?",
"SELECT u.id, u.username, u.is_admin, u.household_id, h.name AS household_name "
"FROM users u JOIN households h ON u.household_id = h.id "
"WHERE u.callback_token = ?",
(token,),
).fetchone()
return dict(row) if row else None