Commit 0ef9bc03 authored by Jean-Philippe Lang's avatar Jean-Philippe Lang

Adds a log message when an API call raises an InvalidAuthenticityToken error.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3332 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent 002f440b
......@@ -227,6 +227,9 @@ class ApplicationController < ActionController::Base
end
def invalid_authenticity_token
if api_request?
logger.error "Form authenticity token is missing or is invalid. API calls must include a proper Content-type header (text/xml or text/json)."
end
render_error "Invalid form authenticity token."
end
......@@ -308,4 +311,8 @@ class ApplicationController < ActionController::Base
def filename_for_content_disposition(name)
request.env['HTTP_USER_AGENT'] =~ %r{MSIE} ? ERB::Util.url_encode(name) : name
end
def api_request?
%w(xml json).include? params[:format]
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment