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