Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to integrate a captcha with devise at registration?

I assume there is some reasonably straightforward way to add Captcha to a rails3 app that's using Devise for authentication, but I cannot find any examples of how to 'connect' a captcha to the registration process.

I see several threads here on SO but they were discussing about the 'why' not the 'how'.

Any pointed would be helpful!

like image 605
jpw Avatar asked Feb 21 '11 19:02

jpw


1 Answers

Take a look at the following guide, this has an implementation of reCAPTCHA:

https://github.com/plataformatec/devise/wiki/How-To:-Use-Recaptcha-with-Devise

  def create
    if method_to_check_captcha
      super
    else
      build_resource
      clean_up_passwords(resource)
      flash[:error] = "There was an error with the captcha code below. Please re-enter the code and click submit."
      render_with_scope :new
    end
  end

From there, just program the method to check the captcha.

like image 100
nvez Avatar answered Sep 21 '22 19:09

nvez