gitlab-org--gitlab-foss/lib/gitlab/auth.rb
Jan-Willem van der Meer 9bf7bfda20 Remove unused methods
2014-10-14 12:09:24 +02:00

18 lines
538 B
Ruby

module Gitlab
class Auth
def find(login, password)
user = User.find_by(email: login) || User.find_by(username: login)
# If no user is found, or it's an LDAP server, try LDAP.
# LDAP users are only authenticated via LDAP
if user.nil? || user.ldap_user?
# Second chance - try LDAP authentication
return nil unless Gitlab::LDAP::Config.enabled?
Gitlab::LDAP::Authentication.login(login, password)
else
user if user.valid_password?(password)
end
end
end
end