Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
ReCaptcha helpers for ruby apps
Ruby

Fetching latest commit…

Cannot retrieve the latest commit at this time

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

README

= ReCAPTCHA

Author:: 		Jason L Perry (http://ambethia.com)
Copyright:: Copyright (c) 2007 Jason L Perry
License::   MIT

This plugin adds helpers for the ReCAPTCHA API (http://recaptcha.net/). In your views you can use
the +recaptcha_tags+ method to embed the needed javascript, and you can validate in your controllers
with +verify_recaptcha+.

You'll want to add your public and private API keys in the environment variables RECAPTCHA_PUBLIC_KEY
and RECAPTCHA_PRIVATE_KEY, respectively. You could also specify them in config/environment.rb if you
are so inclined.

== +recaptcha_tags+

Some of the options available:

<tt>:ssl</tt>:: Uses secure http for captcha widget (default +false+)
<tt>:noscript</tt>:: Include <noscript> content (default +true+)

== +verify_recaptcha+

This method returns +true+ or +false+ after processing the parameters from the ReCAPTCHA widget. Why
isn't this a model validation? Because that violates MVC. Use can use it like this, or how ever you like. Passing in the ActiveRecord object is optional, if you do--and the captcha fails to
verify--an error will be added to the object for you to use.

	respond_to do |format|
	  if verify_recaptcha(@post) && @post.save
	    # ...
	  else
	    # ...
	  end
	end
	
== TODO
* Add some helpers to use in before_filter and what not
* Add support for themes and tabindex
* Better documentation
Something went wrong with that request. Please try again.