From 0170786fd315ef74a385c369c036b33f17879c75 Mon Sep 17 00:00:00 2001 From: agentbox Date: Sat, 1 Aug 2026 06:52:27 +0000 Subject: [PATCH] fix: include is_admin and household_name in get_user_by_callback_token query 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. --- models.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/models.py b/models.py index 727ac2f..b6b89ad 100644 --- a/models.py +++ b/models.py @@ -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