Skip to content
Snippets Groups Projects
Commit aa521c5a authored by Jean-Philippe Lang's avatar Jean-Philippe Lang
Browse files

User model should not have to clean up LDAP attributes.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3488 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent 3de1f2e1
Branches
Tags
No related merge requests found
...@@ -37,7 +37,7 @@ class AuthSourceLdap < AuthSource ...@@ -37,7 +37,7 @@ class AuthSourceLdap < AuthSource
if attrs.first && attrs.first[:dn] && authenticate_dn(attrs.first[:dn], password) if attrs.first && attrs.first[:dn] && authenticate_dn(attrs.first[:dn], password)
logger.debug "Authentication successful for '#{login}'" if logger && logger.debug? logger.debug "Authentication successful for '#{login}'" if logger && logger.debug?
return attrs return [] << attrs.first.except(:dn)
end end
rescue Net::LDAP::LdapError => text rescue Net::LDAP::LdapError => text
raise "LdapError: " + text raise "LdapError: " + text
......
...@@ -111,8 +111,7 @@ class User < Principal ...@@ -111,8 +111,7 @@ class User < Principal
# user is not yet registered, try to authenticate with available sources # user is not yet registered, try to authenticate with available sources
attrs = AuthSource.authenticate(login, password) attrs = AuthSource.authenticate(login, password)
if attrs if attrs
attributes = *attrs user = new(*attrs)
user = new(attributes.symbolize_keys.except(:dn))
user.login = login user.login = login
user.language = Setting.default_language user.language = Setting.default_language
if user.save if user.save
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment