cschiewek / devise_ldap_authenticatable

Devise Module for LDAP
MIT License
594 stars 359 forks source link

Method :has_required_attribute_presence? get wrong result. #267

Open hymanljw opened 3 years ago

hymanljw commented 3 years ago

In file lib/devise_ldap_authenticatable/ldap/connection.rb:213, method has_required_attribute_presence?

@required_attributes_presence.each do |key,val|
  if val && !user.attribute_names.include?(key.to_sym)
    DeviseLdapAuthenticatable::Logger.send("User #{dn} doesn't include attribute #{key}")
    return false
  elsif !val && user.attribute_names.include?(key.to_sym) # <= This looks like a wrong logic, run the method always get false.
    DeviseLdapAuthenticatable::Logger.send("User #{dn} includes attribute #{key}")
    return false
  end
end