firebase重新初始化recaptcha以与其他回调一起使用

时间:2017-11-26 02:18:39

标签: javascript firebase firebase-authentication

如何重新初始化firebase - > recaptcha(已经加载并初始化)与其他回调一起使用?

function my_recaptcha(my_success_callback,my_expired_callback){

    window.recaptchaVerifier = new firebase.auth.RecaptchaVerifier('id_container_recaptcha', {
        'size': 'invisible',
        'callback': function(response) {
            // reCAPTCHA solved, allow user to do action.
            // ... 
            my_success_callback.call(this,arguments);
        },
        'expired-callback': function() {
         // Response expired. Ask user to solve reCAPTCHA again.
         // ...
            my_expired_callback.call(this,arguments);
        }

    });
}

如果我尝试这样的话

my_recaptcha(function(){
    console.log('SUCCES 1')
},function(){
    console.log('EXPIRED 1')
})

my_recaptcha(function(){
    console.log('SUCCES 2')
},function(){
    console.log('EXPIRED 2')
})

我收到了这个错误:

  

未捕获错误:ReCAPTCHA已在此元素中呈现

即使我在grecaptcha.reset(window.recaptchaWidgetId);之前尝试

0 个答案:

没有答案