summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/models/auth_source.rb3
-rw-r--r--app/models/auth_source_ldap.rb4
2 files changed, 5 insertions, 2 deletions
diff --git a/app/models/auth_source.rb b/app/models/auth_source.rb
index a0a2cdc5f..537ed2d43 100644
--- a/app/models/auth_source.rb
+++ b/app/models/auth_source.rb
@@ -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
diff --git a/app/models/auth_source_ldap.rb b/app/models/auth_source_ldap.rb
index 6203a7c85..a619b2f85 100644
--- a/app/models/auth_source_ldap.rb
+++ b/app/models/auth_source_ldap.rb
@@ -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