Move dynamic omniauth declarations to initializer

parent 93505f7d
...@@ -32,10 +32,6 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController ...@@ -32,10 +32,6 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController
end end
end end
Gitlab.config.ldap.servers.each do |server|
alias_method server.provider_name, :ldap
end
def omniauth_error def omniauth_error
@provider = params[:provider] @provider = params[:provider]
@error = params[:error] @error = params[:error]
......
...@@ -2,3 +2,8 @@ module OmniAuth::Strategies ...@@ -2,3 +2,8 @@ module OmniAuth::Strategies
server = Gitlab.config.ldap.servers.first server = Gitlab.config.ldap.servers.first
const_set(server.provider_class, Class.new(LDAP)) const_set(server.provider_class, Class.new(LDAP))
end end
OmniauthCallbacksController.class_eval do
server = Gitlab.config.ldap.servers.first
alias_method server.provider_name, :ldap
end
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment