I have this recaptcha error We detected that your site is not verifying reCAPTCHA solutions. This is required for the proper use of reCAPTCHA on your site. Please see our developer site for more information.
I did everything exactly but its still there recaptcha checkbox return false even after I checked the button
Here is my codes:
In gemfile
gem "recaptcha", require: "recaptcha/rails"
in config in in initializer in recaptcha.rb
Recaptcha.configure do |config|
config.site_key = 'my site key'
config.secret_key = 'my secret key'
end
In view:
<%= recaptcha_tags %>
In controller:
def create
@contact = Contact.new(contact_attributes)
if verify_recaptcha(model: @contact) && @contact.save
ContactMailer.message_send(@contact).deliver
redirect_to contacts_path, notice: "Thank you... Your Message was sent successfully."
else
flash.now[:error] = "Please correct the form"
render :index
end
end
I even try this in recaptcha.rb
Recaptcha.configure do |config|
config.public_key = ENV["RECAPTCHA_PUBLIC_KEY"]
config.private_key = ENV["RECAPTCHA_PRIVATE_KEY"]
end
but I got this error
undefined method `public_key=' for #<Recaptcha::Configuration:0x00007fc132b363e8> (NoMethodError)
Did you mean? public_send
In this link https://www.google.com/recaptcha/api/siteverify I have { "success": false, "error-codes": [ "missing-input-response", "missing-input-secret" ] }
Not sure what to do please help me and thanks in advance