I installed recaptcha according to the gem instructions, however, when I look at the sign_up page (using Devise), catcha does not appear until I refresh the page.
Looking through other comments, it is recommended to disable turbolinks (which I use) by changing the sign_in link to:
<%= link_to "Sign up", new_registration_path, "data-no-turbolink" => true %><br />
I tried this, but I still do not get captcha until I refresh the page.
Relevant Code:
Views / invent / register / new.html.erb
................
<%= recaptcha_tags %>
................
/controllers/users/registrations_controller.rb
class Users::RegistrationsController < Devise::RegistrationsController
def create
if !verify_recaptcha
flash.delete :recaptcha_error
build_resource
resource.valid?
resource.errors.add(:base, "There was an error with the recaptcha code below. Please re-enter the code.")
clean_up_passwords(resource)
respond_with_navigational(resource) { render_with_scope :new }
else
flash.delete :recaptcha_error
super
end
end
def clean_up_passwords(*args)
end
end
source
share