Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

disable direct login provider if value is empty

Markus Kahl86ff20eb46de
diff --git a/app/helpers/omniauth_helper.rb b/app/helpers/omniauth_helper.rb
index 26428f7d9d7..94ff583fd7a 100644
--- a/app/helpers/omniauth_helper.rb
+++ b/app/helpers/omniauth_helper.rb
@@ -42,6 +42,6 @@ module OmniauthHelper
# If this option is active /login will lead directly to the configured omniauth provider
# and so will a click on 'Sign in' (as opposed to opening the drop down menu).
def direct_login_provider
- Setting.omniauth_direct_login_provider
+ Setting.omniauth_direct_login_provider.presence
end
end
diff --git a/spec/controllers/account_controller_spec.rb b/spec/controllers/account_controller_spec.rb
index 00f6d528e6b..1d401b639ac 100644
--- a/spec/controllers/account_controller_spec.rb
+++ b/spec/controllers/account_controller_spec.rb
@@ -434,6 +434,17 @@ RSpec.describe AccountController, :skip_2fa_stage do
end
end
+ describe "#login with omniauth_direct_login_provider set but empty",
+ with_config: { omniauth_direct_login_provider: "" } do
+ describe "GET" do
+ it "does not redirect to some_provider" do
+ get :login
+
+ expect(response).to have_http_status(:ok)
+ end
+ end
+ end
+
describe "Login for user with forced password change" do
let(:admin) { create(:admin, force_password_change: true) }