You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 25, 2021. It is now read-only.
innonate edited this page Dec 28, 2010
·
25 revisions
WARNING: The first draft of this page was done by a total n00b. There wasn't any help here for Recaptcha before, so he hopes this does help some people, but other more experienced should clean this up at a later date.
Install the Recaptcha gem found here (note: for Rails 3 do gem 'recaptcha', :require => 'recaptcha/rails')
Add <%= recaptcha_tags %> on your New Registration view (you must have generated Devise views) the line before your submit button.
Create/Update your RegistrationsController to include the following (the first is for a clean Devise install, and the second is for if you use OmniAuth like me):
Clean:
classRegistrationsController < Devise::RegistrationsControllerdefcreateifverify_recaptchasuperelsebuild_resourceclean_up_passwords(resource)flash[:error]="There was an error with the recaptcha code below. Please re-enter the code and click submit."render_with_scope:newendend....end
With OmniAuth:
classRegistrationsController < Devise::RegistrationsControllerdefcreateifsession[:omniauth] == nil#OmniAuthifverify_recaptchasupersession[:omniauth]=nilunless@user.new_record?#OmniAuthelsebuild_resourceclean_up_passwords(resource)flash[:error]="There was an error with the recaptcha code below. Please re-enter the code and click submit."render_with_scope:newendelsesupersession[:omniauth]=nilunless@user.new_record?#OmniAuthendend