Skip to content

BJClark/vidoopcaptcha

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Rails plugin for VidoopCaptcha service

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published