Sha256: 5f7e31b9c54ed57d8d678ac1a7546735b3b47c291d733116a531af718abf9d12
Contents?: true
Size: 1.01 KB
Versions: 13
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
13 entries across 13 versions & 1 rubygems