From 34ab6489ba5255c8dd0a5368012d2e88e13018db Mon Sep 17 00:00:00 2001 From: Ben Finney Date: Mon, 19 Dec 2022 09:25:58 +1100 Subject: [PATCH] Reformat SQL statement for clarity and wrap the long line. --- auth-mastodon.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/auth-mastodon.py b/auth-mastodon.py index 0849a64..efc9714 100644 --- a/auth-mastodon.py +++ b/auth-mastodon.py @@ -21,7 +21,15 @@ db_name = "mastodon" # This is the query that pulls the password hash for the given user. Mastodon doesn't store the domain for local accounts in # the database, so we ignore the host component and try to match username where the domain is NULL. -db_query_getpass = "select users.encrypted_password as password from accounts inner join users on accounts.id=users.account_id where lower(accounts.username) = %(user)s and accounts.domain is null" +db_query_getpass = """ + SELECT users.encrypted_password AS password + FROM accounts + INNER JOIN users + ON accounts.id = users.account_id + WHERE + lower(accounts.username) = %(user)s + AND accounts.domain IS NULL + """ ######################################################################## # Setup