diff --git a/app/models/auth_source_ldap.rb b/app/models/auth_source_ldap.rb index 1378d004d917f46574b06440a24cbd94054f73ff..0a53550721e8725d3d75eee319db4b14cb597dc1 100644 --- a/app/models/auth_source_ldap.rb +++ b/app/models/auth_source_ldap.rb @@ -37,7 +37,7 @@ class AuthSourceLdap < AuthSource 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 diff --git a/app/models/user.rb b/app/models/user.rb index 496ca2137047b9acf9fdb346041cd2db764f92db..8a69fda00b444182d0d7203a8f0f24ae8ff300a0 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -111,8 +111,7 @@ class User < Principal # 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