summaryrefslogtreecommitdiffstats
path: root/app/models/auth_source_ldap.rb
diff options
context:
space:
mode:
authorEric Davis <edavis@littlestreamsoftware.com>2010-02-18 16:55:05 +0000
committerEric Davis <edavis@littlestreamsoftware.com>2010-02-18 16:55:05 +0000
commit82dd1b2bf29d3e84eddb1a45c14b7ddb9adf7360 (patch)
tree5d0a886e813c748cd6c2e4eeb2fc37b69a429bef /app/models/auth_source_ldap.rb
parent899fb1079fb5507936b7408dc46aa79d913d394e (diff)
downloadredmine-82dd1b2bf29d3e84eddb1a45c14b7ddb9adf7360.tar.gz
redmine-82dd1b2bf29d3e84eddb1a45c14b7ddb9adf7360.zip
Refactor: Moved the check for an empty DN to authenticate_dn
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3449 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/auth_source_ldap.rb')
-rw-r--r--app/models/auth_source_ldap.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/app/models/auth_source_ldap.rb b/app/models/auth_source_ldap.rb
index d3ede3005..da453ae98 100644
--- a/app/models/auth_source_ldap.rb
+++ b/app/models/auth_source_ldap.rb
@@ -45,10 +45,9 @@ class AuthSourceLdap < AuthSource
:attributes=> (onthefly_register? ? ['dn', self.attr_firstname, self.attr_lastname, self.attr_mail] : ['dn'])) do |entry|
dn = entry.dn
attrs = get_user_attributes_from_ldap_entry(entry) if onthefly_register?
+ logger.debug "DN found for #{login}: #{dn}" if logger && logger.debug?
end
- return nil if dn.empty?
- logger.debug "DN found for #{login}: #{dn}" if logger && logger.debug?
if authenticate_dn(dn, password)
logger.debug "Authentication successful for '#{login}'" if logger && logger.debug?
@@ -100,6 +99,8 @@ class AuthSourceLdap < AuthSource
# Check if a DN (user record) authenticates with the password
def authenticate_dn(dn, password)
+ return nil if dn.empty?
+
ldap_con = initialize_ldap_con(dn, password)
return ldap_con.bind
end