Classes and Modules
Constants
ERROR_MESSAGES | = | { :missing_data=>"_forme_set_data parameter not submitted, make sure the forme_set Sequel plugin is loaded", :missing_hmac=>"_forme_set_data_hmac parameter not submitted, make sure the forme_set Sequel plugin is loaded", :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 unless app.opts[:forme_set_hmac_secret] = opts[:secret] || app.opts[:forme_set_hmac_secret] 17 raise RodaError, "must provide :secret option to forme_set plugin" 18 end 19 20 if block 21 app.send(:define_method, :_forme_set_handle_error, &block) 22 app.send(:private, :_forme_set_handle_error) 23 end 24 end
load_dependencies(app, opts = nil, &_)
Require the forme_route_csrf plugin.
[show source]
# File lib/roda/plugins/forme_set.rb 10 def self.load_dependencies(app, opts = nil, &_) 11 app.plugin :forme_route_csrf 12 end