##// END OF EJS Templates
User model should not have to clean up LDAP attributes....
Jean-Philippe Lang -
r3374:aa521c5a5a31
parent child
Show More
@@ -37,7 +37,7 class AuthSourceLdap < AuthSource
37
37
38 if attrs.first && attrs.first[:dn] && authenticate_dn(attrs.first[:dn], password)
38 if attrs.first && attrs.first[:dn] && authenticate_dn(attrs.first[:dn], password)
39 logger.debug "Authentication successful for '#{login}'" if logger && logger.debug?
39 logger.debug "Authentication successful for '#{login}'" if logger && logger.debug?
40 return attrs
40 return [] << attrs.first.except(:dn)
41 end
41 end
42 rescue Net::LDAP::LdapError => text
42 rescue Net::LDAP::LdapError => text
43 raise "LdapError: " + text
43 raise "LdapError: " + text
@@ -111,8 +111,7 class User < Principal
111 # user is not yet registered, try to authenticate with available sources
111 # user is not yet registered, try to authenticate with available sources
112 attrs = AuthSource.authenticate(login, password)
112 attrs = AuthSource.authenticate(login, password)
113 if attrs
113 if attrs
114 attributes = *attrs
114 user = new(*attrs)
115 user = new(attributes.symbolize_keys.except(:dn))
116 user.login = login
115 user.login = login
117 user.language = Setting.default_language
116 user.language = Setting.default_language
118 if user.save
117 if user.save
General Comments 0
You need to be logged in to leave comments. Login now