Merge branch '48677-also-check-auto_sign_in_with_provider' into 'master'
Resolve "Undefined omniauth_authorize_path when omniauth_enabled not enabled" Closes #48677 See merge request gitlab-org/gitlab-ce!20302
This commit is contained in:
commit
b0fa01fce3
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: Load Devise with Omniauth when auto_sign_in_with_provider is configured
|
||||
merge_request: 20302
|
||||
author:
|
||||
type: fixed
|
||||
|
|
@ -219,7 +219,7 @@ Devise.setup do |config|
|
|||
end
|
||||
end
|
||||
|
||||
if Gitlab.config.omniauth.enabled
|
||||
if Gitlab::OmniauthInitializer.enabled?
|
||||
Gitlab::OmniauthInitializer.new(config).execute(Gitlab.config.omniauth.providers)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ OmniAuth.config.before_request_phase do |env|
|
|||
Gitlab::RequestForgeryProtection.call(env)
|
||||
end
|
||||
|
||||
if Gitlab.config.omniauth.enabled
|
||||
if Gitlab::OmniauthInitializer.enabled?
|
||||
provider_names = Gitlab.config.omniauth.providers.map(&:name)
|
||||
Gitlab::Auth.omniauth_setup_providers(provider_names)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,5 +1,10 @@
|
|||
module Gitlab
|
||||
class OmniauthInitializer
|
||||
def self.enabled?
|
||||
Gitlab.config.omniauth.enabled ||
|
||||
Gitlab.config.omniauth.auto_sign_in_with_provider.present?
|
||||
end
|
||||
|
||||
def initialize(devise_config)
|
||||
@devise_config = devise_config
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in New Issue