how to integrate a captcha with devise at registration?
I assume there is some reasonably straightforwa开发者_如何学Pythonrd 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!
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.
精彩评论