Skip to content

Commit

Permalink
Admins that are not signed in are redirected to the signin page when …
Browse files Browse the repository at this point in the history
…doing admin actions
  • Loading branch information
farhatahmad committed Feb 24, 2020
1 parent 4753740 commit 6824e15
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,23 @@ def handle_bigbluebutton_error

# Manually deal with 401 errors
rescue_from CanCan::AccessDenied do |_exception|
render "errors/greenlight_error"
if current_user
render "errors/greenlight_error"
else
# Store the current url as a cookie to redirect to after sigining in
cookies[:return_to] = request.url

# Get the correct signin path
path = if allow_greenlight_accounts?
signin_path
elsif Rails.configuration.loadbalanced_configuration
omniauth_login_url(:bn_launcher)
else
signin_path
end

redirect_to path
end
end

private
Expand Down

0 comments on commit 6824e15

Please sign in to comment.