module Roda::RodaPlugins::FormeSet

  1. lib/roda/plugins/forme_set.rb

Methods

Public Class

  1. configure
  2. load_dependencies

Constants

ERROR_MESSAGES = { :missing_data=>"_forme_set_data parameter not submitted", :missing_hmac=>"_forme_set_data_hmac parameter not submitted", :hmac_mismatch=>"_forme_set_data_hmac does not match _forme_set_data", :csrf_mismatch=>"_forme_set_data CSRF token does not match submitted CSRF token", :missing_namespace=>"no content in expected namespace" }.freeze  

Map of error types to error messages

Public Class methods

configure (app, opts = OPTS, &block)

Set the HMAC secret.

[show source]
   # File lib/roda/plugins/forme_set.rb
15 def self.configure(app, opts = OPTS, &block)
16   app.opts[:forme_set_hmac_secret] = opts[:secret] || app.opts[:forme_set_hmac_secret]
17 
18   if block
19     app.send(:define_method, :_forme_set_handle_error, &block)
20     app.send(:private, :_forme_set_handle_error)
21   end
22 end
load_dependencies (app, _ = nil)

Require the forme_route_csrf plugin.

[show source]
   # File lib/roda/plugins/forme_set.rb
10 def self.load_dependencies(app, _ = nil)
11   app.plugin :forme_route_csrf 
12 end