Commit 20a88f5c43efa3ab0af80d26c90268132e6f7997
1 parent
228baa80
Exists in
master
and in
4 other branches
LDAP authentication in grack - check ldap conf before call / added comment
Showing
1 changed file
with
6 additions
and
2 deletions
Show diff stats
lib/gitlab/backend/grack_auth.rb
... | ... | @@ -34,11 +34,15 @@ module Grack |
34 | 34 | login, password = @auth.credentials |
35 | 35 | self.user = User.find_by_email(login) || User.find_by_username(login) |
36 | 36 | |
37 | - if user.nil? | |
37 | + # If the provided login was not a known email or username | |
38 | + # then user is nil | |
39 | + if user.nil? | |
40 | + # Second chance - try LDAP authentication | |
41 | + return false unless Gitlab.config.ldap.enabled | |
38 | 42 | ldap_auth(login,password) |
39 | 43 | return false unless !user.nil? |
40 | 44 | else |
41 | - return false unless user.valid_password?(password); | |
45 | + return false unless user.valid_password?(password) | |
42 | 46 | end |
43 | 47 | |
44 | 48 | Gitlab::ShellEnv.set_env(user) | ... | ... |