【问题标题】:How to implement the new invisible reCAPTCHA on form?如何在表单上实现新的隐形 reCAPTCHA?
【发布时间】:2017-04-04 07:17:42
【问题描述】:

我正在尝试让新的“隐形”版本的 google reCAPTCHA 在我的表单上运行。

我正在使用https://github.com/UndefinedOffset/silverstripe-nocaptcha

根据文档,您应该可以在 config.yml 中进行更改,我认为它是不可见的?

default_size: "invisible"

--

public function HelloForm() {
        $fields = new FieldList(
            new TextField('Name'),
            new EmailField('Email'),
            new TextareaField('Message')
        );
        $actions = new FieldList(
            new FormAction('doSubmitHelloForm', 'Submit')
        );

        $form = new Form($this, 'HelloForm', $fields, $actions);

        $form->enableSpamProtection()
            ->fields()->fieldByName('Captcha')
            ->setTitle("Spam protection")
            ->setDescription("Please tick the box to prove you're a human and help us stop spam.");

        return $form;
    }

config.yml

NocaptchaField:
  site_key: "MYKEYINHERE" #Your site key (required)
  secret_key: "MYKEYINHERE" #Your secret key (required)
  verify_ssl: true #Allows you to disable php-curl's SSL peer verification by setting this to false (optional, defaults to true)
  default_theme: "light" #Default theme color (optional, light or dark, defaults to light)
  default_type: "image" #Default captcha type (optional, image or audio, defaults to image)
  default_size: "invisible" #Default size (optional, normal, compact or invisible, defaults to normal)
  proxy_server: "" #Your proxy server address (optional)
  proxy_auth: "" #Your proxy server authentication information (optional)

但是验证码仍然显示,我错过了什么吗? (请注意,我只是在本地开发机器 atm 上进行测试)。

【问题讨论】:

  • 更改配置后你刷了吗?
  • @RobbieAverill - 是的。
  • 我认为目前没有任何 reCaptcha 模块支持(全新的!)隐形模块。但是,我建议切换到 chillu/silverstripe-recaptcha 模块,因为它似乎维护得更好,并且归 SilverStripe 自己的 Chillu 所有。
  • @SimonErkelens the readme 问题中的模块似乎表明它确实支持“不可见”大小
  • 我在模块上创建了一个问题单。所以看看作者怎么说。

标签: silverstripe


【解决方案1】:

好的,这里有 2 个问题。

  1. 我最初使用的是旧版本的 nocaptcha 模块。然后我升级到 0.3.0(发布时的最新版本),验证码按我们的意愿被隐藏了。

  2. 模块中存在一个错误,这意味着它在提交表单时一直显示错误消息(说需要勾选验证码)。作者现在已经修复了这个问题,并将尽快将此版本标记为 0.4.0。

:)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-09-15
    • 1970-01-01
    • 2020-10-24
    • 2019-12-07
    • 2018-04-09
    相关资源
    最近更新 更多