allow plugins to override login redirection when authentication failed
This commit is contained in:
parent
41aa05df68
commit
d9326dd984
1 changed files with 6 additions and 1 deletions
|
@ -37,7 +37,7 @@ class ApplicationController < ActionController::Base
|
||||||
# No user at all: redirect to login page.
|
# No user at all: redirect to login page.
|
||||||
session[:user_id] = nil
|
session[:user_id] = nil
|
||||||
session[:return_to] = request.original_url
|
session[:return_to] = request.original_url
|
||||||
redirect_to login_url, :alert => I18n.t('application.controller.error_authn')
|
redirect_to_login :alert => I18n.t('application.controller.error_authn')
|
||||||
else
|
else
|
||||||
# We have an authenticated user, now check role...
|
# We have an authenticated user, now check role...
|
||||||
# Roles gets the user through his memberships.
|
# Roles gets the user through his memberships.
|
||||||
|
@ -104,6 +104,11 @@ class ApplicationController < ActionController::Base
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Redirect to the login page, used in authenticate, plugins can override this.
|
||||||
|
def redirect_to_login(options={})
|
||||||
|
redirect_to login_url, options
|
||||||
|
end
|
||||||
|
|
||||||
# Stores this controller instance as a thread local varibale to be accessible from outside ActionController/ActionView.
|
# Stores this controller instance as a thread local varibale to be accessible from outside ActionController/ActionView.
|
||||||
def store_controller
|
def store_controller
|
||||||
Thread.current[:application_controller] = self
|
Thread.current[:application_controller] = self
|
||||||
|
|
Loading…
Reference in a new issue