简体   繁体   English

Recaptcha Rails使用reCAPTCHA的v2或版本2

[英]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: 我正在尝试使用最新版本的recaptcha,在视图上,我的验证码看起来像: 当前的验证码

I would like it look like https://developers.google.com/recaptcha , here's a picture: 我希望它看起来像https://developers.google.com/recaptcha ,这是一张图片:

在此输入图像描述

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 任何人都知道如何使用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. 支持v2 API的recaptcha版本尚未发布,因此您需要直接从Github使用该版本。

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

And then in the initializer ( config/initializers/recaptcha.rb ) 然后在初始化程序中( 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 : 我目前解决了将此问题添加到Gemfile的问题:

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

config.api_version = "v2" seems not to be supported anymore. 似乎不再支持config.api_version = "v2"了。 That's probably because the support for V1 was removed from version 1.0.0 ( changelog ) 这可能是因为V1的支持已从版本1.0.0中删除( 更改日志

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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