Sha256: d27455eccfdd603d0fd27db5f98d356934dd62a1291dc196141cd6e1da89ed6b
Contents?: true
Size: 1.01 KB
Versions: 41
Compression:
Stored size: 1.01 KB
Contents
module Locomotive module Steam module Liquid module Tags module Csrf class Base < ::Liquid::Tag def render(context) service = context.registers[:services].csrf_protection if service.enabled? render_csrf(service) else '' end end end class Param < Base def render_csrf(service) %(<input type="hidden" name="#{service.field}" value="#{service.token}" />) end end class Meta < Base def render_csrf(service) %{ <meta name="csrf-param" content="#{service.field}" /> <meta name="csrf-token" content="#{service.token}" /> } end end end ::Liquid::Template.register_tag('csrf_param'.freeze, Csrf::Param) ::Liquid::Template.register_tag('csrf_meta'.freeze, Csrf::Meta) end end end end
Version data entries
41 entries across 41 versions & 1 rubygems