mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
14 lines
527 B
Ruby
14 lines
527 B
Ruby
module ActionView
|
|
# = Action View CSRF Helper
|
|
module Helpers
|
|
module CsrfHelper
|
|
# Returns a meta tag with the cross-site request forgery protection token
|
|
# for forms to use. Place this in your head.
|
|
def csrf_meta_tag
|
|
if protect_against_forgery?
|
|
%(<meta name="csrf-param" content="#{Rack::Utils.escape_html(request_forgery_protection_token)}"/>\n<meta name="csrf-token" content="#{Rack::Utils.escape_html(form_authenticity_token)}"/>).html_safe
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|