Fix #2008 Add support for Cloudflare Turnstile

This commit is contained in:
Lastorder 2023-05-04 14:46:43 +09:00
parent 32ffc94dee
commit bd44b4ef54
5 changed files with 80 additions and 10 deletions

View file

@ -77,7 +77,7 @@ class spamfilterAdminController extends spamfilter
{
$config->captcha = new stdClass;
}
$config->captcha->type = $vars->captcha_type === 'recaptcha' ? 'recaptcha' : 'none';
$config->captcha->type = in_array($vars->captcha_type, ['recaptcha', 'turnstile']) ? $vars->captcha_type : 'none';
$config->captcha->site_key = escape(utf8_trim($vars->site_key));
$config->captcha->secret_key = escape(utf8_trim($vars->secret_key));
if ($config->captcha->type !== 'none' && (!$config->captcha->site_key || !$config->captcha->secret_key))