diff --git a/auth-mastodon.py b/auth-mastodon.py index 2a1b0bf..ad366dc 100644 --- a/auth-mastodon.py +++ b/auth-mastodon.py @@ -12,7 +12,7 @@ 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 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 @@ -97,7 +97,7 @@ def get_password(user, host): # Right now we ignore the host component, as Mastodon doesn't store it for local accounts. # It may be required one day, so the code to handle passing it to the query is left in for now. cursor = database.cursor() - cursor.execute(db_query_getpass, {"user": user, "host": host}) + cursor.execute(db_query_getpass, {"user": user.lower(), "host": host}) data = cursor.fetchone() cursor.close() return data[0] if data != None else None