简体   繁体   中英

Recaptcha Rails use v2 or version 2 of reCAPTCHA

I'm trying to use the latest version of recaptcha, on views, my captcha looks like: 当前的验证码

I would like it look like https://developers.google.com/recaptcha , here's a picture:

在此输入图像描述

in my form I have:

= form_for [refinery, :inquiries, @inquiry], html: { id: "contact-form" } do |f|    
  = recaptcha_tags display: { display: 'red'}

Anyone know how to accomplish this with gem "recaptcha" , https://github.com/ambethia/recaptcha

Thank you in advance.

The version of recaptcha that supports the v2 API hasn't been released yet so you need to use the version directly from Github.

gem "recaptcha", github: "ambethia/recaptcha"

And then in the initializer ( config/initializers/recaptcha.rb )

Recaptcha.configure do |config|
  config.api_version = "v2"
  ...
end

This answer probably just need an update.

I currently solved the problem adding this to the Gemfile :

gem "recaptcha", require: "recaptcha/rails"

config.api_version = "v2" seems not to be supported anymore. That's probably because the support for V1 was removed from version 1.0.0 ( changelog )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM