Sha256: 7a21580475b24bd8c8c65e1c7fac4a197447489ef8d351a7487c3d1a921d30d9
Contents?: true
Size: 1.06 KB
Versions: 31
Compression:
Stored size: 1.06 KB
Contents
module Smithy module Liquid module Tags module Csrf class Param < ::Liquid::Tag def render(context) controller = context.registers[:controller] name = controller.send(:request_forgery_protection_token).to_s value = controller.send(:form_authenticity_token) %(<input type="hidden" name="#{name}" value="#{value}">) end end class Meta < ::Liquid::Tag def render(context) controller = context.registers[:controller] name = controller.send(:request_forgery_protection_token).to_s value = controller.send(:form_authenticity_token) %{<meta name="csrf-param" content="#{name}">\n} + %{<meta name="csrf-token" content="#{value}">} end end end ::Liquid::Template.register_tag('csrf_param', Csrf::Param) ::Liquid::Template.register_tag('csrf_meta_tag', Csrf::Meta) ::Liquid::Template.register_tag('csrf_meta_tags', Csrf::Meta) end end end
Version data entries
31 entries across 31 versions & 1 rubygems