mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
Expose CSRF param name also
This commit is contained in:
@@ -4,7 +4,7 @@ module ActionView
|
||||
# Returns a meta tag with the request forgery protection token for forms to use. Put this in your head.
|
||||
def csrf_meta_tag
|
||||
if protect_against_forgery?
|
||||
%(<meta name="csrf-token" content="#{Rack::Utils.escape(form_authenticity_token)}"/>).html_safe
|
||||
%(<meta name="csrf-param" content="#{Rack::Utils.escape(request_forgery_protection_token)}"/>\n<meta name="csrf-token" content="#{Rack::Utils.escape(form_authenticity_token)}"/>).html_safe
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -218,7 +218,7 @@ class RequestForgeryProtectionControllerTest < ActionController::TestCase
|
||||
|
||||
test 'should emit a csrf-token meta tag' do
|
||||
get :meta
|
||||
assert_equal %(<meta name="csrf-token" content="#{@token}"/>), @response.body
|
||||
assert_equal %(<meta name="csrf-param" content="authenticity_token"/>\n<meta name="csrf-token" content="#{@token}"/>), @response.body
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user