Invidious is an alternative front-end to YouTube
Only check invalid size passwords on register
Omar Rothc912e63fb5ba
diff --git a/src/invidious.cr b/src/invidious.crindex 2c26e24b..34c9384f 100644--- a/src/invidious.cr+++ b/src/invidious.cr@@ -803,17 +803,6 @@ post "/login" do |env|next templated "error"end- if password.empty?- error_message = "Password cannot be empty"- next templated "error"- end-- # See https://security.stackexchange.com/a/39851- if password.size > 55- error_message = "Password cannot be longer than 55 characters"- next templated "error"- end-if !challenge_response || !tokenerror_message = "CAPTCHA is a required field"next templated "error"@@ -856,6 +845,17 @@ post "/login" do |env|next templated "error"endelsif action == "register"+ if password.empty?+ error_message = "Password cannot be empty"+ next templated "error"+ end++ # See https://security.stackexchange.com/a/39851+ if password.size > 55+ error_message = "Password cannot be longer than 55 characters"+ next templated "error"+ end+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"