FIX: captcha render

This commit is contained in:
Tony Air 2023-11-18 04:03:24 +02:00
parent 3bf38f5203
commit 3c67f3006c
2 changed files with 5 additions and 3 deletions

View File

@ -1,6 +1,6 @@
{
"name": "@a2nt/ss-bootstrap-ui-webpack-boilerplate-react",
"version": "5.1.3",
"version": "5.1.4",
"description": "This UI Kit allows you to build Bootstrap 5 webapp with some extra UI features. It's easy to extend and easy to convert HTML templates to CMS templates.",
"author": "Tony Air <tony@twma.pro>",
"license": "BSD-2-Clause",

View File

@ -44,6 +44,8 @@ const CaptchaUI = ((window) => {
})
}
window.rendergcaptcha = attachCaptcha;
const loadScript = (callback) => {
if (typeof window.grecaptcha !== 'undefined') {
callback()
@ -53,11 +55,11 @@ const CaptchaUI = ((window) => {
const script = document.createElement('script');
script.id = 'captchaAPI';
script.src = `https://www.google.com/recaptcha/api.js?render=explicit&hl=${document.querySelector('html').getAttribute('lang').substr(0, 2)}`
script.src = `https://www.google.com/recaptcha/api.js?onload=rendergcaptcha&render=explicit&hl=${document.querySelector('html').getAttribute('lang').substr(0, 2)}`
script.async = true
script.onload = function () {
console.log(`${NAME}: Captcha API is loaded.`)
setTimeout(callback, 1000)
//setTimeout(callback, 1000)
}
document.body.append(script)