mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-30 16:49:58 +09:00
Fix fatal error if CAPTCHA is configured but disabled
This commit is contained in:
parent
aaf3791a78
commit
04b158c544
2 changed files with 8 additions and 4 deletions
|
|
@ -337,8 +337,12 @@ class SpamfilterController extends Spamfilter
|
|||
if (count($target_actions))
|
||||
{
|
||||
$captcha_class = 'Rhymix\\Modules\\Spamfilter\\Captcha\\' . $config->captcha->type;
|
||||
$captcha_class::init($config->captcha);
|
||||
if (!class_exists($captcha_class))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$captcha_class::init($config->captcha);
|
||||
if (strncasecmp('proc', $obj->act, 4) === 0)
|
||||
{
|
||||
$captcha_class::check();
|
||||
|
|
|
|||
|
|
@ -218,7 +218,7 @@ class SpamfilterModel extends Spamfilter
|
|||
{
|
||||
$config = ModuleModel::getModuleConfig('spamfilter');
|
||||
$user = Context::get('logged_info');
|
||||
if (!isset($config) || empty($config->captcha) || empty($config->captcha->type) || empty($config->captcha->site_key) || empty($config->captcha->secret_key))
|
||||
if (!isset($config) || empty($config->captcha) || empty($config->captcha->type) || $config->captcha->type === 'none' || empty($config->captcha->site_key) || empty($config->captcha->secret_key))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
@ -253,7 +253,7 @@ class SpamfilterModel extends Spamfilter
|
|||
public static function getCaptcha($target_action = null)
|
||||
{
|
||||
$config = ModuleModel::getModuleConfig('spamfilter');
|
||||
if (!isset($config) || empty($config->captcha) || empty($config->captcha->type) || empty($config->captcha->site_key) || empty($config->captcha->secret_key))
|
||||
if (!isset($config) || empty($config->captcha) || empty($config->captcha->type) || $config->captcha->type === 'none' || empty($config->captcha->site_key) || empty($config->captcha->secret_key))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
|
@ -285,7 +285,7 @@ class SpamfilterModel extends Spamfilter
|
|||
public static function checkCaptchaResponse(?string $response = null): void
|
||||
{
|
||||
$config = ModuleModel::getModuleConfig('spamfilter');
|
||||
if (!isset($config) || empty($config->captcha) || empty($config->captcha->type) || empty($config->captcha->site_key) || empty($config->captcha->secret_key))
|
||||
if (!isset($config) || empty($config->captcha) || empty($config->captcha->type) || $config->captcha->type === 'none' || empty($config->captcha->site_key) || empty($config->captcha->secret_key))
|
||||
{
|
||||
throw new Exception('msg_recaptcha_not_configured');
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue