Move dynamic omniauth declarations to initializer

parent 93505f7d
......@@ -32,10 +32,6 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController
end
end
Gitlab.config.ldap.servers.each do |server|
alias_method server.provider_name, :ldap
end
def omniauth_error
@provider = params[:provider]
@error = params[:error]
......
......@@ -2,3 +2,8 @@ module OmniAuth::Strategies
server = Gitlab.config.ldap.servers.first
const_set(server.provider_class, Class.new(LDAP))
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