Commit 20a88f5c authored by Friedrich Beckmann's avatar Friedrich Beckmann

LDAP authentication in grack - check ldap conf before call / added comment

parent 228baa80
...@@ -34,11 +34,15 @@ module Grack ...@@ -34,11 +34,15 @@ module Grack
login, password = @auth.credentials login, password = @auth.credentials
self.user = User.find_by_email(login) || User.find_by_username(login) self.user = User.find_by_email(login) || User.find_by_username(login)
if user.nil? # If the provided login was not a known email or username
# then user is nil
if user.nil?
# Second chance - try LDAP authentication
return false unless Gitlab.config.ldap.enabled
ldap_auth(login,password) ldap_auth(login,password)
return false unless !user.nil? return false unless !user.nil?
else else
return false unless user.valid_password?(password); return false unless user.valid_password?(password)
end end
Gitlab::ShellEnv.set_env(user) Gitlab::ShellEnv.set_env(user)
......
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