diff --git a/app/controllers/api/v1/users_controller.rb b/app/controllers/api/v1/users_controller.rb
index 09c860e4ed..9a2436f6bb 100644
--- a/app/controllers/api/v1/users_controller.rb
+++ b/app/controllers/api/v1/users_controller.rb
@@ -62,7 +62,7 @@ def create
create_user_params[:language] = current_user&.language || I18n.default_locale if create_user_params[:language].blank?
# renders an error if the user is signing up with an invalid domain based off site settings
- return render_error errors: Rails.configuration.custom_error_msgs[:unauthorized], status: :forbidden unless valid_domain?
+ return render_error errors: Rails.configuration.custom_error_msgs[:banned_user], status: :forbidden unless valid_domain?
user = UserCreator.new(user_params: create_user_params.except(:invite_token), provider: current_provider, role: default_role).call
diff --git a/app/controllers/external_controller.rb b/app/controllers/external_controller.rb
index 8b512663b1..d552dae03a 100644
--- a/app/controllers/external_controller.rb
+++ b/app/controllers/external_controller.rb
@@ -48,9 +48,10 @@ def create_user
return redirect_to root_path(error: Rails.configuration.custom_error_msgs[:invite_token_invalid])
end
- return render_error status: :forbidden unless valid_domain?(user_info[:email])
+ # Redirect to root if the user doesn't exist and has an invalid domain
+ return redirect_to root_path(error: Rails.configuration.custom_error_msgs[:banned_user]) if new_user && !valid_domain?(user_info[:email])
- # Create the user if they dont exist
+ # Create the user if they don't exist
if new_user
user = UserCreator.new(user_params: user_info, provider: current_provider, role: default_role).call
user.save!
diff --git a/app/javascript/components/admin/site_settings/registration/Registration.jsx b/app/javascript/components/admin/site_settings/registration/Registration.jsx
index 7d9029666f..764e5b00f5 100644
--- a/app/javascript/components/admin/site_settings/registration/Registration.jsx
+++ b/app/javascript/components/admin/site_settings/registration/Registration.jsx
@@ -108,6 +108,7 @@ export default function Registration() {