diff --git a/locales/en-US.json b/locales/en-US.json index 6c5625c3..2db67e0b 100644 --- a/locales/en-US.json +++ b/locales/en-US.json @@ -61,6 +61,7 @@ "Sign Up": "Sign Up", "create_account_link_label": "Create an account", "sign_up_page_title": "Sign Up", + "registration_user_id_has_been_taken_error": "User ID has been taken", "E-mail": "E-mail", "Preferences": "Preferences", "preferences_category_player": "Player preferences", diff --git a/src/invidious/routes/login.cr b/src/invidious/routes/login.cr index d04eddca..78143121 100644 --- a/src/invidious/routes/login.cr +++ b/src/invidious/routes/login.cr @@ -101,6 +101,11 @@ module Invidious::Routes::Login return error_template(401, "User ID is a required field") end + # Ensure user doesn't exist + if Invidious::Database::Users.select(email: email) + return error_template(401, "registration_user_id_has_been_taken_error") + end + if password.nil? || password.empty? return error_template(401, "Password cannot be empty") end