-
Notifications
You must be signed in to change notification settings - Fork 0
simple rails app to demonstrate using captcha plugins
jmccaffrey/rails_captcha_demo
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
== Rails Captcha demo a few examples of captcha on a rails 2.3.5 app http://simple-captcha-demo.heroku.com/ blog post on http://railsperformance.blogspot.com http://railsperformance.blogspot.com/2011/03/rails-captcha-plugins.html github repo https://github.com/jmccaffrey/rails_captcha_demo My requirements were: "add a captcha to the forgot password page" I looked on ruby-toolbox (http://www.ruby-toolbox.com/categories/rails_captcha.html) to see what plugins were being used and had good traction, and narrowed it to these three: Simple-Captcha http://expressica.com/simple_captcha 1. requires rmagick to create the image 2. requires db:migrate to persist the keyed answer 3. works well, easy enough to change script/plugin install svn://rubyforge.org/var/svn/expressica/plugins/simple_captcha rake simple_captcha:setup rake db:migrate #add to routes map.simple_captcha '/simple_captcha/:action', :controller => 'simple_captcha' #add to application_controller include SimpleCaptcha::ControllerHelpers reCaptcha (sponsored by google) http://www.google.com/recaptcha 1.commonly used, well tested, looks professional 2. requires outbound http call, (may have to deal with proxies) 3. can handle ssl 4. can play audio if text is too hard 5. expects String.html_safe (rails > 2.3.7), had to monkey patch a do nothing method 6. has styling options, but I had problems getting it to look right in the form I was using script/plugin install git://github.com/ambethia/recaptcha.git # in config/initializers/recaptcha.rb #monkey patch to fix html_safe method class String def html_safe self end end # get an api key (free) from http://www.google.com/recaptcha ENV['RECAPTCHA_PUBLIC_KEY'] = 'youractualpublickey' ENV['RECAPTCHA_PRIVATE_KEY'] = 'youractualprivatekey' # in the view, inside your form <%= recaptcha_tags %> # in the controller def update @user = User.find(params[:id]) if verify_recaptcha if @user.update_attributes(params[:user]) flash[:notice] = 'User was successfully updated.' redirect_to(@user) else render :action => "edit" end else flash[:error] = 'Captcha no good' render :action => "edit" end end BrainBuster https://github.com/rsanheim/brain_buster 1. doesn't make 3rd party outbound call 2. doesn't require rmagick 3. does require a db table to store a set of questions 4. presents the user with a set of logic questions 5. by default uses cookies to flag that a user has answered successfully, but that can be turned off to always challenge the user 6. handles numeric to text conversion when a user answers 'five' or '5'
About
simple rails app to demonstrate using captcha plugins
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published