fixes #2389
This commit is contained in:
@@ -14,6 +14,7 @@ class ApplicationController < ActionController::Base
|
||||
|
||||
rescue_from Exception, :with => :rescue_exception
|
||||
rescue_from User::PrivilegeError, :with => :access_denied
|
||||
rescue_from SessionLoader::AuthenticationFailure, :with => :authentication_failed
|
||||
rescue_from Danbooru::Paginator::PaginationError, :with => :render_pagination_limit
|
||||
|
||||
protected
|
||||
@@ -47,6 +48,18 @@ protected
|
||||
render :template => "static/error", :status => 410
|
||||
end
|
||||
|
||||
def authentication_failed
|
||||
respond_to do |fmt|
|
||||
fmt.html do
|
||||
render :text => "authentication failed", :status => 401
|
||||
end
|
||||
|
||||
fmt.json do
|
||||
render :json => {:success => false, :reason => "authentication failed"}, :status => 401
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def access_denied(exception = nil)
|
||||
previous_url = params[:url] || request.fullpath
|
||||
|
||||
|
||||
Reference in New Issue
Block a user