mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
Handle routes properly when the app is running in a subdirectory
This commit is contained in:
parent
eb8c85c18f
commit
138106c2fb
1 changed files with 4 additions and 4 deletions
|
|
@ -6,7 +6,7 @@ class ApplicationController < ActionController::Base
|
||||||
:authenticate_user!
|
:authenticate_user!
|
||||||
|
|
||||||
if (current_user.nil?)
|
if (current_user.nil?)
|
||||||
redirect_to '/accounts/sign_in'
|
redirect_to new_user_session_path
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -24,7 +24,7 @@ class ApplicationController < ActionController::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
## Todo simplify this
|
## Todo simplify this
|
||||||
redirect_to '/' unless has_role?(current_user, 'admin') || has_role?(current_user, 'organizer')
|
redirect_to root_path unless has_role?(current_user, 'admin') || has_role?(current_user, 'organizer')
|
||||||
end
|
end
|
||||||
|
|
||||||
def verify_admin
|
def verify_admin
|
||||||
|
|
@ -32,7 +32,7 @@ class ApplicationController < ActionController::Base
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
redirect_to '/' unless has_role?(current_user, 'admin')
|
redirect_to root_path unless has_role?(current_user, 'admin')
|
||||||
end
|
end
|
||||||
|
|
||||||
def current_ability
|
def current_ability
|
||||||
|
|
@ -41,6 +41,6 @@ class ApplicationController < ActionController::Base
|
||||||
|
|
||||||
rescue_from CanCan::AccessDenied do |exception|
|
rescue_from CanCan::AccessDenied do |exception|
|
||||||
Rails.logger.debug("Access denied!")
|
Rails.logger.debug("Access denied!")
|
||||||
redirect_to '/', :alert => exception.message
|
redirect_to root_path, :alert => exception.message
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue