my Devise Recaptcha isn't working correctly because I can skip right over it and still register.
I followed the Devise wiki at - https://github.com/plataformatec/devise/wiki/How-To:-Use-Recaptcha-with-Devise and got everything working accept i encountered the problem above.
Here is my code:
app/controllers/users/registrations.rb
class Users::RegistrationsController < Devise::RegistrationsController
def create
if verify_recaptcha
super
else
build_resource
clean_up_passwords(resource)
flash[:alert] = "There was an error with the recaptcha code below. Please re-enter the code and click submit."
render_with_scope :new
end
end
end
routes.rb
YourApp::Application.routes.draw do
devise_for :users do
root :to => "devise/registrations#new"
get "/" => "devise/registrations#new"
post '/' => 'registrations#new', :as => :new_user_registration
match '/', :to => 'devise/registrations#new'
.
.
.
.
.
end
devise_for :users, :controllers => { :registrations => "users/registrations" }
namespace :user do
root :to => "home#index"
end
config/initializers/recaptcha.rb
Recaptcha.configure do |config|
config.public_key = 'mykey123456789'
config.private_key = 'mykey13456789'
end
It is possible it doesn't work because i am in test mode and not on my domain name?
Help would be appreciated!