]> source.dussan.org Git - redmine.git/commitdiff
Do not request blank LDAP attributes.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Tue, 25 Nov 2008 19:33:41 +0000 (19:33 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Tue, 25 Nov 2008 19:33:41 +0000 (19:33 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2056 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/auth_source.rb
app/models/auth_source_ldap.rb

index a0a2cdc5f398aea4fdbac7aa26f5728f373a6bf4..537ed2d43f438781e5ca79b89bf859eeef0c3a66 100644 (file)
@@ -38,7 +38,8 @@ class AuthSource < ActiveRecord::Base
       begin
         logger.debug "Authenticating '#{login}' against '#{source.name}'" if logger && logger.debug?
         attrs = source.authenticate(login, password)
-      rescue
+      rescue => e
+        logger.error "Error during authentication: #{e.message}"
         attrs = nil
       end
       return attrs if attrs
index 6203a7c856d26aa68ec63e637ac5d70c6591bef9..a619b2f85770b78d62b2403810a262dde0b42b0f 100644 (file)
@@ -91,6 +91,8 @@ class AuthSourceLdap < AuthSource
   end
   
   def self.get_attr(entry, attr_name)
-    entry[attr_name].is_a?(Array) ? entry[attr_name].first : entry[attr_name]
+    if !attr_name.blank?
+      entry[attr_name].is_a?(Array) ? entry[attr_name].first : entry[attr_name]
+    end
   end
 end