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", "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.", "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>", "author": "Tony Air <tony@twma.pro>",
"license": "BSD-2-Clause", "license": "BSD-2-Clause",

View File

@ -44,6 +44,8 @@ const CaptchaUI = ((window) => {
}) })
} }
window.rendergcaptcha = attachCaptcha;
const loadScript = (callback) => { const loadScript = (callback) => {
if (typeof window.grecaptcha !== 'undefined') { if (typeof window.grecaptcha !== 'undefined') {
callback() callback()
@ -53,11 +55,11 @@ const CaptchaUI = ((window) => {
const script = document.createElement('script'); const script = document.createElement('script');
script.id = 'captchaAPI'; 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.async = true
script.onload = function () { script.onload = function () {
console.log(`${NAME}: Captcha API is loaded.`) console.log(`${NAME}: Captcha API is loaded.`)
setTimeout(callback, 1000) //setTimeout(callback, 1000)
} }
document.body.append(script) document.body.append(script)