Skip to content

Commit

Permalink
fix mass assignment error in some rails/redmine versions. set authent…
Browse files Browse the repository at this point in the history
…ication mode to the auth source where an ldap synced user was found
  • Loading branch information
jkalbhenn committed Apr 3, 2019
1 parent 033d0b1 commit b007399
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/redmine_env_auth/env_auth_patch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,11 @@ def register_if_exists_in_ldap login
logger.debug "redmine_env_auth: missing attributes #{missing_attrs} from ldap, cant create user"
next
end
user = User.new ldap_user.slice(:login, :firstname, :lastname, :mail)
user = User.new ldap_user.slice(:firstname, :lastname, :mail)
user.login = ldap_user[:login]
# registered users will be able to log in using ldap if redmine_env_auth is disabled.
# an alternative would be to not set auth_source_id, users without password can not log in.
user.auth_source_id = auth_source.id
if user.save
user.reload
logger.debug "redmine_env_auth: user creation after ldap sync successful"
Expand Down

0 comments on commit b007399

Please sign in to comment.