Module: Roda::RodaPlugins::FormeSet
- Defined in:
- lib/roda/plugins/forme_set.rb
Defined Under Namespace
Modules: InstanceMethods Classes: Error
Constant Summary collapse
- ERROR_MESSAGES =
Map of error types to 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
Class Method Summary collapse
-
.configure(app, opts = OPTS, &block) ⇒ Object
Set the HMAC secret.
-
.load_dependencies(app, _ = nil) ⇒ Object
Require the forme_route_csrf plugin.
Class Method Details
.configure(app, opts = OPTS, &block) ⇒ Object
Set the HMAC secret.
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/roda/plugins/forme_set.rb', line 15 def self.configure(app, opts = OPTS, &block) unless app.opts[:forme_set_hmac_secret] = opts[:secret] || app.opts[:forme_set_hmac_secret] raise RodaError, "must provide :secret option to forme_set plugin" end if block app.send(:define_method, :_forme_set_handle_error, &block) app.send(:private, :_forme_set_handle_error) end end |
.load_dependencies(app, _ = nil) ⇒ Object
Require the forme_route_csrf plugin.
10 11 12 |
# File 'lib/roda/plugins/forme_set.rb', line 10 def self.load_dependencies(app, _ = nil) app.plugin :forme_route_csrf end |