Skip to content

Commit

Permalink
Merge pull request #2016 from hennevogel/fix_issues_2015
Browse files Browse the repository at this point in the history
[webui] Introduces proxy_mode user active check
  • Loading branch information
adrianschroeter committed Aug 15, 2016
2 parents 2e566e0 + 9569ed5 commit cad97a4
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/api/app/controllers/webui/webui_controller.rb
Expand Up @@ -211,7 +211,7 @@ def check_user
return
end

# If the user logs in for the first time (before we have a User with that login)
# The user does not exist in our database, create her.
unless User.where(login: user_login).exists?
logger.debug "Creating user #{user_login}"
chars = ["A".."Z", "a".."z", "0".."9"].collect { |r| r.to_a }.join
Expand All @@ -223,9 +223,15 @@ def check_user
password: fakepw)
end

User.current = User.find_by_login(user_login)
# The user exists, check if shes active and update the info
User.current = User.find_by(login: user_login)
unless User.current.is_active?
session[:login] = nil
User.current = User.find_nobody!
redirect_to(CONFIG['proxy_auth_logout_page'], error: "Your account is disabled. Please contact the adminsitrator for details.")
return
end
User.current.update_user_info_from_proxy_env(request.env)
return
end

User.current = User.find_by_login(session[:login]) if session[:login]
Expand Down

0 comments on commit cad97a4

Please sign in to comment.