This commit is contained in:
r888888888
2015-06-18 17:03:33 -07:00
parent 850cabe8fc
commit 64516b3a37
2 changed files with 23 additions and 0 deletions

View File

@@ -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