Ember octane:ember-g-reCAPTCHA reCaptchaResponse返回为未定义 [英] Ember Octane: ember-g-recaptcha reCaptchaResponse comes back as undefined

查看:15
本文介绍了Ember octane:ember-g-reCAPTCHA reCaptchaResponse返回为未定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在升级到Ember Octane,我正在使用ember-g-reCAPTCHAhttps://www.npmjs.com/package/ember-g-recaptcha。项目README.MD尚未更新以反映Ember辛烷。组件js中的reCaptchaResponse不断返回undefined。我如何修复此问题?

我已经在这里发布了Ember-Twidlehttps://ember-twiddle.com/509eb1c04c9c7d908d16ba2a2bb39ba5。注意:您需要提供站点密钥才能使用它。

这就是我要做的:

<GRecaptcha 
    @size="normal" 
    @sitekey={{this.siteKey}} 
    @onSuccess={{action "onCaptchaResolved"}} 
    @onExpired={{action "onCaptchaExpired"}} 
    @ref={{mut this.googleRecaptcha}} 
/>

我已经在GitHub中发布了代码:https://github.com/IlliterateUser/GoogleReCaptcha

尽管如此,页面不会显示,控制台也不会抛出任何错误。当我有更多的时间时,我需要在周末看看这个。

推荐答案

GRecaptcha加载项正在从配置环境文件中获取站点密钥,您将其设置为如下

 gReCaptcha: {
      jsUrl: 'https://www.google.com/recaptcha/api.js?render=explicit', // default
      siteKey: '...lQ-sUAAAA...KGVMS6zlH_xry5fon9GP1..'
    }

不要将其作为参数传递,请注释站点密钥导入

////import ENV from '../../config/environment';
...
//  siteKey = ENV.gRecaptcha.siteKey;

并在没有站点密钥参数的情况下调用它,

<GRecaptcha
          @size="normal" 
          @onSuccess={{action "onCaptchaResolved"}} 
          @onExpired={{action "onCaptchaExpired"}} 
          @ref={{mut this.googleRecaptcha}} 
 />

这对我很管用

这篇关于Ember octane:ember-g-reCAPTCHA reCaptchaResponse返回为未定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆