Agile Web Development

Build it. Launch it. Love it.

Less Reverse Captcha

LessReverseCaptcha

=====

The Less Reverse Capchta creates a captcha that is invisible to the user. Rather than force the user to prove they are a human, we are allowing bots to prove they are bots. The captcha field is hidden and so humans will leave it blank. Bots do not realize it is hidden so they will fill out the field. The validator checks to see if the field is blank, if it is it allows the save, if not, it does not allow it. To use less reverse captcha simply put ‘validates_captcha’ in the model and use the ‘captcha_field’ helper in your view.

new.html.erb

<%= flash[:notice] %> <%= error_messages_for :comment %>

<% form_for @comment do |form| %>

  <%= form.text_area :comment %>
  <%= less_reverse_captcha_field :comment %>

  <%= submit_tag %>

<% end %>

comments_controller.rb def create

  @comment = Comment.create params[:comment]
  if @comment.new_record?
    render :action=>'index'
  else
    redirect_to comments_path
  end

end

comment.rb

class Comment < ActiveRecord::Base

  validates_less_reverse_captcha

Vitals

Home http://github.com/stevenbristol/less-reverse-captcha/tree/master
Repository git://github.com/stevenbristol/less-reverse-captcha.git
License Rails' (MIT)
Tags Tag_red captcha security spam
Rating (4 votes)
Owner Steven Bristol
Created 8 October 2008

Comments

  • Avatar
    grosser
    17 October 2008

    The honeypot plugin does something similar(providing an empty field and one filled (both hidden)), but uses views + controller

    http://github.com/grosser/honeypot/tree/master

  • Avatar
    RYounes
    2 December 2008

    It seems like either your premise that bots cannot determine that the field is hidden is false, or your form is not friendly to screen readers. I.e., if a screen reader can figure out that the field is hidden, why can't a bot? If it can't, then visually impaired users can't use your form.

Add a comment