forked from External/greenlight
Admins that are not signed in are redirected to the signin page when doing admin actions (#964)
This commit is contained in:
parent
475374090a
commit
54234ef54b
|
@ -200,7 +200,23 @@ class ApplicationController < ActionController::Base
|
|||
|
||||
# Manually deal with 401 errors
|
||||
rescue_from CanCan::AccessDenied do |_exception|
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue