-
Notifications
You must be signed in to change notification settings - Fork 0
lightweight captcha plugin for rails apps
License
srejbi/mini_captcha
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
== MiniCaptcha
Minimalistic captcha plugin for rails projects.
Install and integrate to the existing code:
[0) install RMagick and Digest -- if not yet installed]
1) install mini_captcha:
# script/plugin install git@github.com:srejbi/mini_captcha.git
2) add the following lines to your application controller:
require 'vendor/plugins/mini_captcha/lib/mini_captcha'
include MiniCaptcha::ControllerHelpers
3) add a map to the MiniCaptcha controller for the MiniCaptcha image display
map.mini_captcha '/mini_captcha/:action', :controller => 'mini_captcha', :action => 'show_image'
4) add a div like this to any view you want to protect with MiniCaptcha from spam:
... (your page & form)...
<div class="..."><%= show_mini_captcha %> </div>
... (your page) ....
5) update the processing controller similarly to the following block:
if @form.valid? your original validation
if mini_captcha_valid? extend it with checking the MiniCaptchaChallenge
do whatever...
flash[:notice] = 'Your form input was correct.'
redirect as you wish
else belongs to your new validation of MiniCaptchaChallenge (failure branch)
flash[:error] = 'Failed MiniCaptcha Challenge.'
punish the 'bot, piss off the user (just kidding ;))
end end of yout new block for MiniCaptchaChallenge failure
end
6) enjoy getting less, more real comments :-)
Credits: thanks to milkfarm (http://github.com/milkfarm) for specs, ideas, and actual updates on the code.
About
lightweight captcha plugin for rails apps
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published