How do I add Honey pot fields to my forms?

后端 未结 5 2287
灰色年华
灰色年华 2020-12-17 17:31

I\'ve been reading about adding Honey pot fields to my forms for combating bots/spam. Only problem is theirs no guides or anything on where to start. Many sites say to make

5条回答
  •  悲&欢浪女
    2020-12-17 17:59

    Try invisible_captcha (supports Rails 3, 4 and 5).

    It works pretty well for small and medium (in terms of traffic) sites, with a simple and flexible approach. It also provides time-sensitive submissions.

    Basic usage

    In your form:

    <%= form_for(@topic) %>
      <%= invisible_captcha %>
      ...
    <% end %>
    

    In your controller:

    class TopicsController < ApplicationController
      invisible_captcha only: [:create, :update]
      ...
    end
    

提交回复
热议问题