Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Rails plugin for VidoopCaptcha service
JavaScript Ruby
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
spec
tasks
MIT-LICENSE
README
Rakefile
flyout.min.js
init.rb
install.rb
uninstall.rb
vidoop_captcha.yml

README

VidoopCaptcha
=============

Rails plugin for integrating Vidoop's Captcha service into a rails app.

Dependencies: Net:HTTPS, Hpricot

Example
=======
-1. Check out my Fork of the Authlogic Example app with the Vidoop Captcha plugin. The best commit to check out is here: http://github.com/BJClark/authlogic_example_with_vidoop_captcha/commit/ed1b2dc82e2269c8aaca09965dc1343a531727e9  That shows all the code needed to install the plugin, generate a captcha, and verify it against Vidoop's servers.

On to the install:

0. Sign up for a VidoopSecure account at: https://login.vidoop.com/accounts/create/

1. script/plugin install

2. Edit config/vidoop_captcha.yml with your information from Step 1.

3. Assuming your form uses form_for, in your view add the following line in your form where you want your captcha to appear.

<%=  vidoop_captcha() %>

4. In the model for your form, you'll want something similar to:

attr_accessor :vidoop_captcha
validates_presence_of :vidoop_captcha, :on => :create
validates_associated :vidoop_captcha

5. In your controller, you'll want to use the VidoopCaptcha#build method to pass the params to:

@user = User.new(params[:user].merge(:vidoop_captcha => VidoopCaptcha.build(params[:captcha_id], params[:captcha])))

6. Include Vidoop Captcha Flyout Library & JQuery

The plugin won't include the flyout.min.js file in your layout, so make sure you do a <%= javascript_include_tag "flyout.min" %> .
The flyout.min.js file requires JQuery. Please install JQuery or the JRails plugin if you don't use JQuery.

7. Profit!

You'll notice that your model doesn't pass validations without a valid captcha, so just redirect back to the form and it will show the error with the form.


Something to note is that every time you show a captcha, you have to make a Net::HTTPS call to the Vidoop servers to request creation of a captcha. Just something to keep in mind.

Copyright (c) 2009 AboutUs.org, released under the MIT license
Created by BJ Clark (@RobotDeathSquad) for AboutUs.org
Something went wrong with that request. Please try again.