Module: FormGuard::ViewHelper

Defined in:
lib/form_guard/view_helper.rb

Instance Method Summary collapse

Instance Method Details

#form_guard_fieldsObject



5
6
7
8
9
10
11
12
13
14
# File 'lib/form_guard/view_helper.rb', line 5

def form_guard_fields
  config = FormGuard.configuration

  tag.div style: "display:none;", "aria-hidden": "true" do
    safe_join([
      hidden_field_tag("#{config.honeypot_field_prefix}#{SecureRandom.hex(4)}", nil, autocomplete: "off"),
      hidden_field_tag( "#{config.honeypot_time_prefix}#{SecureRandom.hex(4)}", Time.now.to_i, autocomplete: "off")
    ])
  end
end