I had the <%= csrf_meta_tags %>
in my HEAD tag, but I created the form manually, so the authenticity_token
hidden field was not getting inserted in my form.
So I added the authenticity_token
manually:
<input name="authenticity_token" value="<%= form_authenticity_token %>" type="hidden">
When I send my website's default contact form (user is not logged in) the action that handles it should verify the token and allow/deny the request. But it is not: I use jQuery to empty the field and submit the form but not error or exception are thrown.
I got this line protect_from_forgery with: :exception
in application_controller.rb
and put the same in the foo_controller.rb
that extends application_controller and has the action that responds to the contact form.
So what am I missing? What do I have to do to have this form verified in the backend?
Thanks a lot!