mirror of
https://github.com/solero/houdini.git
synced 2024-11-21 21:17:21 +00:00
Do not rely on username column being lowercase always
This commit is contained in:
parent
2675e6b4e7
commit
6e292ac1db
@ -3,6 +3,7 @@ import os
|
|||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
|
|
||||||
import bcrypt
|
import bcrypt
|
||||||
|
from sqlalchemy import func
|
||||||
|
|
||||||
from houdini import handlers
|
from houdini import handlers
|
||||||
from houdini.constants import ClientType
|
from houdini.constants import ClientType
|
||||||
@ -24,7 +25,7 @@ async def handle_login(p, credentials: Credentials):
|
|||||||
username, password = credentials.username, credentials.password
|
username, password = credentials.username, credentials.password
|
||||||
p.logger.info(f'{username} is logging in!')
|
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:
|
if data is None:
|
||||||
p.logger.info(f'{username} failed to login: penguin does not exist')
|
p.logger.info(f'{username} failed to login: penguin does not exist')
|
||||||
|
Loading…
Reference in New Issue
Block a user