##// END OF EJS Templates
Refactor: Rewrite authenticate_dn to use an implicit return....
Eric Davis -
r3336:6f930e9be647
parent child
Show More
@@ -52,8 +52,6 class AuthSourceLdap < AuthSource
52 52 if authenticate_dn(dn, password)
53 53 logger.debug "Authentication successful for '#{login}'" if logger && logger.debug?
54 54 return attrs
55 else
56 return nil
57 55 end
58 56 rescue Net::LDAP::LdapError => text
59 57 raise "LdapError: " + text
@@ -99,10 +97,9 class AuthSourceLdap < AuthSource
99 97
100 98 # Check if a DN (user record) authenticates with the password
101 99 def authenticate_dn(dn, password)
102 return nil if dn.empty?
103
104 ldap_con = initialize_ldap_con(dn, password)
105 return ldap_con.bind
100 if dn.present? && password.present?
101 initialize_ldap_con(dn, password).bind
102 end
106 103 end
107 104
108 105 def self.get_attr(entry, attr_name)
General Comments 0
You need to be logged in to leave comments. Login now