Invidious is an alternative front-end to YouTube
Make usernames case-insensitive
Omar Rothe2c15468e021
diff --git a/src/invidious.cr b/src/invidious.crindex a6b77c54..a73054fc 100644--- a/src/invidious.cr+++ b/src/invidious.cr@@ -755,7 +755,7 @@ post "/login" do |env|endif action == "signin"- user = PG_DB.query_one?("SELECT * FROM users WHERE email = $1 AND password IS NOT NULL", email, as: User)+ user = PG_DB.query_one?("SELECT * FROM users WHERE LOWER(email) = LOWER($1) AND password IS NOT NULL", email, as: User)if !usererror_message = "Invalid username or password"@@ -769,7 +769,7 @@ post "/login" do |env|if Crypto::Bcrypt::Password.new(user.password.not_nil!) == passwordsid = Base64.urlsafe_encode(Random::Secure.random_bytes(32))- PG_DB.exec("UPDATE users SET id = id || $1 WHERE email = $2", [sid], email)+ PG_DB.exec("UPDATE users SET id = id || $1 WHERE LOWER(email) = LOWER($2)", [sid], email)if Kemal.config.ssl || CONFIG.https_onlysecure = true@@ -784,7 +784,7 @@ post "/login" do |env|next templated "error"endelsif action == "register"- user = PG_DB.query_one?("SELECT * FROM users WHERE email = $1 AND password IS NOT NULL", email, as: User)+ user = PG_DB.query_one?("SELECT * FROM users WHERE LOWER(email) = LOWER($1) AND password IS NOT NULL", email, as: User)if usererror_message = "Please sign in"next templated "error"