Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Reverse Captcha for your Rails app
Ruby
tree: c5b464515c

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
tasks
test
MIT-LICENSE
README.textile
Rakefile
init.rb
install.rb
uninstall.rb

README.textile

Trap Door – Reverse Captcha for Rails

Unobtrusive Captcha for your Rails forms. Trap Door works by adding a hidden “honeypot” field to your forms that only a spam bot will fill out. A before filter checks for the presence of this field and banishes bots to a spam trap.

Installation

script/plugin install git://github.com/hardbap/trap_door.git

Using Trap Door

In your view


    <% form_for(@post) do |form| %>
        <%= trap_door_field %>
        
        # the rest of your form...

In your controller


    class ProjectsController < ApplicationController
        trap_door :only => :create
        
        # the rest of your controller...

Configuration

By default Trap Door names the hidden_field :affiliate_id. Obviously this won’t work for everyone so you can change the field name by creating an initializer in config/initializers and telling Trap Door the name it should use for the honeypot field:

TrapDoor.honeypot_field_name = :go_away

Copyright © 2009 Mike Breen, released under the MIT license

Something went wrong with that request. Please try again.