Fix race condition between our setup and Google's.
This commit is contained in:
parent
cedda40d8d
commit
c97cbc252e
@ -60,14 +60,25 @@ QR.captcha =
|
||||
|
||||
$.globalEval '''
|
||||
(function() {
|
||||
var container = document.querySelector("#qr .captcha-container");
|
||||
container.dataset.widgetID = window.grecaptcha.render(container, {
|
||||
sitekey: '<%= meta.recaptchaKey %>',
|
||||
theme: document.documentElement.classList.contains('tomorrow') ? 'dark' : 'light',
|
||||
callback: function(response) {
|
||||
window.dispatchEvent(new CustomEvent("captcha:success", {detail: response}));
|
||||
function render() {
|
||||
var container = document.querySelector("#qr .captcha-container");
|
||||
container.dataset.widgetID = window.grecaptcha.render(container, {
|
||||
sitekey: '<%= meta.recaptchaKey %>',
|
||||
theme: document.documentElement.classList.contains('tomorrow') ? 'dark' : 'light',
|
||||
callback: function(response) {
|
||||
window.dispatchEvent(new CustomEvent("captcha:success", {detail: response}));
|
||||
}
|
||||
});
|
||||
}
|
||||
if (window.grecaptcha) {
|
||||
render();
|
||||
} else {
|
||||
var cbNative = window.onRecaptchaLoaded;
|
||||
window.onRecaptchaLoaded = function() {
|
||||
render();
|
||||
cbNative();
|
||||
}
|
||||
});
|
||||
}
|
||||
})();
|
||||
'''
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user