main.js: do not initialize captchas if there is no hook

This commit is contained in:
Zankaria 2024-08-23 14:36:12 +02:00
parent 111fa78921
commit 3994afd10d

View file

@ -349,8 +349,10 @@ function isDynamicCaptchaEnabled() {
function initCaptcha() { function initCaptcha() {
if (isDynamicCaptchaEnabled()) { if (isDynamicCaptchaEnabled()) {
let captcha_hook = document.getElementById('captcha'); let captcha_hook = document.getElementById('captcha');
captcha_hook.style = ""; if (captcha_hook) {
initCaptchaImpl(); captcha_hook.style = "";
initCaptchaImpl();
}
} }
} }
{% endif %} // End if dynamic captcha {% endif %} // End if dynamic captcha