Sha256: a6c6a2251b3255af5259ca8152d766f9bd2abb65486fd62dcf52cb055623477f

Contents?: true

Size: 1.7 KB

Versions: 2

Compression:

Stored size: 1.7 KB

Contents

Captcha
=======

It is text captcha validation plugin for Rails applications. It creates 
random question and validates the captcha answer after the submition of the
form.

Installation
============

Text Captcha installation process.

    script/plugin install git://github.com/hokam/text_captcha.git

Uninstallation
==============

    script/plugin remove text_captcha


Usage
=====

After installation process you need to add 'before_filter' callback in your
controller to create question captcha before the processing of specified actions.

Suppose you have a CommentsController in which you want to create capthca question
for "new" action so just add the following lines in your controller.

class CommentsController << ActionController::Base
  before_filter :create_question_captcha, :only => [:new]
  # ....
  # ....
end

And for validation of captcha text you need to call validate_captcha funtion in
the required action. Lets say in "create" action of CommentsController you want 
to apply captcha validation, so do the following addition in your 'create' action.


class CommentsController << ActionController::Base
  before_filter :create_question_captcha, :only => [:new]

  def new
    # action related data
  end
  # other action methods

  def create
    if validate_captcha_answer
      # ........
    else
      # ........
    end
  end
end

And add the following line in your html view to create captcha image.

<%= text_captcha_tag %>

If captcha validation failes then text captcha plugin set the error message in 
flash[:notice] variable, so you should use flash[:notice] variable in your form
for the notification of captcha failure message.

<%= flash[:notice] if flash[:notice] %> 

To read more, use following.

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
webroar-0.7.0 src/admin_panel/vendor/plugins/text_captcha/README
webroar-0.6.1 src/admin_panel/vendor/plugins/text_captcha/README