diff --git a/templates/main.js b/templates/main.js index 1fe26b6a..7ae44054 100755 --- a/templates/main.js +++ b/templates/main.js @@ -231,7 +231,7 @@ function init_stylechooser() { } function get_cookie(cookie_name) { - var results = document.cookie.match ( '(^|;) ?' + cookie_name + '=([^;]*)(;|$)'); + var results = document.cookie.match('(^|;) ?' + cookie_name + '=([^;]*)(;|$)'); if (results) return (unescape(results[2])); else @@ -241,7 +241,7 @@ function get_cookie(cookie_name) { {% endraw %} {% if config.dynamic_captcha %} function is_dynamic_captcha_enabled() { - let cookie = get_cookie('require-captcha'); + let cookie = get_cookie('captcha-required'); return cookie === '1'; } @@ -254,7 +254,7 @@ function get_captcha_pub_key() { } function init_dynamic_captcha() { - if (!is_dynamic_captcha_enabled()) { + if (is_dynamic_captcha_enabled()) { let pub_key = get_captcha_pub_key(); if (!pub_key) { console.error("Missing public captcha key!"); @@ -265,6 +265,8 @@ function init_dynamic_captcha() { captcha_hook.style = ""; } } +{% else %} +function init_dynamic_captcha() {} {% endif %} {% raw %} @@ -420,6 +422,7 @@ var script_settings = function(script_name) { function init() { init_stylechooser(); + init_dynamic_captcha(); {% endraw %} {% if config.allow_delete %}