From ed7c74d474902eed2ee7b75ff6dbbcff23a04849 Mon Sep 17 00:00:00 2001 From: Tony Air Date: Fri, 29 Mar 2024 18:39:30 +0200 Subject: [PATCH] IMPR: reset existing captcha on AJAX --- src/js/ui/captcha.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/js/ui/captcha.js b/src/js/ui/captcha.js index 1f76db0..11c2967 100644 --- a/src/js/ui/captcha.js +++ b/src/js/ui/captcha.js @@ -6,6 +6,10 @@ const CaptchaUI = ((window) => { const init = () => { console.log(`${NAME}: init`) + if (typeof window.grecaptcha.render !== 'function') { + window.grecaptcha.reset() + } + const submitListener = (e) => { console.log(`${NAME}: Validating Captcha ...`) const field = e.currentTarget.querySelectorAll(`.${NAME}, .g-recaptcha`).forEach((el) => {