From 42f7d4f8d27f64ed0eedf85ef9899f960a042665 Mon Sep 17 00:00:00 2001 From: shawn-higgins1 <23224097+shawn-higgins1@users.noreply.github.com> Date: Tue, 23 Jul 2019 11:08:38 -0400 Subject: [PATCH] If a user only has one configured provider redirect them to that provider (#647) --- app/controllers/users_controller.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index c28d1c0f..1dd7267f 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -67,6 +67,12 @@ class UsersController < ApplicationController flash[:alert] = I18n.t("registration.deprecated.new_signin") session[:old_twitter_user_id] = params[:old_twitter_user_id] unless params[:old_twitter_user_id].nil? end + + providers = configured_providers + if (!allow_user_signup? || !allow_greenlight_accounts?) && providers.count == 1 && + !Rails.configuration.loadbalanced_configuration + return redirect_to "#{Rails.configuration.relative_url_root}/auth/#{providers.first}" + end end # GET /ldap_signin