summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorJan-Willem van der Meer <mail@jewilmeer.nl>2014-10-15 09:53:16 +0200
committerJan-Willem van der Meer <mail@jewilmeer.nl>2014-10-15 09:53:16 +0200
commitdcf6c26075027c56e733da7db06e5e355b40074e (patch)
tree3abdd7a389386e18aa983722a611224c18d87eec /config
parente3bd17a7ba5238c147a79d0770e8503fd913610c (diff)
downloadgitlab-ce-dcf6c26075027c56e733da7db06e5e355b40074e.tar.gz
Only enable LDAP providers if LDAP is enabled
Diffstat (limited to 'config')
-rw-r--r--config/initializers/7_omniauth.rb16
-rw-r--r--config/initializers/devise.rb2
2 files changed, 10 insertions, 8 deletions
diff --git a/config/initializers/7_omniauth.rb b/config/initializers/7_omniauth.rb
index 7ef5c10da08..b8ac87fbd5a 100644
--- a/config/initializers/7_omniauth.rb
+++ b/config/initializers/7_omniauth.rb
@@ -1,9 +1,11 @@
-module OmniAuth::Strategies
- server = Gitlab.config.ldap.servers.values.first
- const_set(server['provider_class'], Class.new(LDAP))
-end
+if Gitlab::LDAP::Config.enabled?
+ module OmniAuth::Strategies
+ server = Gitlab.config.ldap.servers.values.first
+ const_set(server['provider_class'], Class.new(LDAP))
+ end
-OmniauthCallbacksController.class_eval do
- server = Gitlab.config.ldap.servers.values.first
- alias_method server['provider_name'], :ldap
+ OmniauthCallbacksController.class_eval do
+ server = Gitlab.config.ldap.servers.values.first
+ alias_method server['provider_name'], :ldap
+ end
end \ No newline at end of file
diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb
index 226cacfe0d1..c6eb3e51036 100644
--- a/config/initializers/devise.rb
+++ b/config/initializers/devise.rb
@@ -204,7 +204,7 @@ Devise.setup do |config|
# manager.default_strategies(scope: :user).unshift :some_external_strategy
# end
- if Gitlab.config.ldap.enabled
+ if Gitlab::LDAP::Config.enabled?
Gitlab.config.ldap.servers.values.each do |server|
if server['allow_username_or_email_login']
email_stripping_proc = ->(name) {name.gsub(/@.*$/,'')}