From 6e292ac1dbaae78af9e15dc11cf71eb23fb91ab7 Mon Sep 17 00:00:00 2001 From: Ben Date: Fri, 5 Jun 2020 22:48:01 +0100 Subject: [PATCH] Do not rely on username column being lowercase always --- houdini/handlers/login/login.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/houdini/handlers/login/login.py b/houdini/handlers/login/login.py index 72a23a7..f2b858b 100644 --- a/houdini/handlers/login/login.py +++ b/houdini/handlers/login/login.py @@ -3,6 +3,7 @@ import os from datetime import datetime, timedelta import bcrypt +from sqlalchemy import func from houdini import handlers from houdini.constants import ClientType @@ -24,7 +25,7 @@ async def handle_login(p, credentials: Credentials): username, password = credentials.username, credentials.password p.logger.info(f'{username} is logging in!') - data = await Penguin.query.where(Penguin.username == username).gino.first() + data = await Penguin.query.where(func.lower(Penguin.username) == username).gino.first() if data is None: p.logger.info(f'{username} failed to login: penguin does not exist')