Catptcha

A visual captcha for web sites. The user is shown a grid of 9 images and is asked to click the kittens. Distributed in the form of a Rails 2.3 plugin.

This is based on a concept from KittenAuth.

This is still experimental and incomplete, but it's ready for others to try out and offer help/feedback.

Installation

From within your Rails application:

Add the gem to your Gemfile and load the rake tasks.

echo "gem 'catptcha'" >> Gemfile
echo "load 'tasks/catptcha.rake'" >> Rakefile

Put your flickr keys in config/flickr.yml, see flickr.example.yml.

Generate and run the migration.

ruby script/generate catptcha_migration add_catptcha_tables
rake db:migrate

Run the tests.

rake db:test:prepare
rake catptcha:test

Seed the images.

rake catptcha:seed

If you have Amazon S3 configured on Rails boot, you can easily upload the images to your own bucket. Otherwise images are still served from Flickr!

./script/runner 'Catptcha::Seed.s3_upload("YOUR_BUCKET_NAME")'

Usage

Include the partial in your form contents.

render :inline => Catptcha.puzzle_tags :catptcha_guess

Check the result in your controller.

if Catptcha.check_guess(params[:catptcha_guess])`.
  # passed
else
  # failed
end

There are also tools for implementing an admin/review UI:

# Get all kitten images, paginated (uses will_paginate)
Catptcha.paginate_kitten_images(page)

# Get all not-a-kitten images, paginated (uses will_paginate)
Catptcha.paginate_not_kitten_images(page)

# remove an image given the key
Catptcha.remove_image(key)

TODO and Known Bugs

  • current implementation is closely tied to ActiveRecord and Flickr

Author

Copyright (c) 2012 ENTP, released under the MIT license