From 7a8d5a391a29c3f4c6e326a667f80c2f4ff965bc Mon Sep 17 00:00:00 2001 From: Omar Roth Date: Thu, 18 Apr 2019 19:17:50 -0500 Subject: [PATCH] Fix downcasting with usernames --- src/invidious.cr | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/invidious.cr b/src/invidious.cr index 33f35afa..4e48fab0 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -814,7 +814,7 @@ post "/login" do |env| next templated "error" end - email = env.params.body["email"]? + email = env.params.body["email"]?.try &.downcase password = env.params.body["password"]? account_type = env.params.query["type"]? @@ -1024,7 +1024,7 @@ post "/login" do |env| next templated "error" end - user = PG_DB.query_one?("SELECT * FROM users WHERE LOWER(email) = LOWER($1)", email, as: User) + user = PG_DB.query_one?("SELECT * FROM users WHERE email = $1", email, as: User) if user if !user.password