if attrs.first && attrs.first[:dn] && authenticate_dn(attrs.first[:dn], password)
logger.debug "Authentication successful for '#{login}'" if logger && logger.debug?
- return attrs
+ return [] << attrs.first.except(:dn)
end
rescue Net::LDAP::LdapError => text
raise "LdapError: " + text
# user is not yet registered, try to authenticate with available sources
attrs = AuthSource.authenticate(login, password)
if attrs
- attributes = *attrs
- user = new(attributes.symbolize_keys.except(:dn))
+ user = new(*attrs)
user.login = login
user.language = Setting.default_language
if user.save