Fix crash if no captcha is enabled

This commit is contained in:
Zankaria 2024-04-01 19:36:37 +02:00 committed by Zankaria
parent 3016d69428
commit 650ef8bcc2

View File

@ -627,11 +627,13 @@ if (isset($_POST['delete'])) {
$query = RemoteCaptchaQuery::withHCaptcha($context->getHttpDriver(), $config['hcaptcha_private']); $query = RemoteCaptchaQuery::withHCaptcha($context->getHttpDriver(), $config['hcaptcha_private']);
} }
if (isset($query, $response)) {
$success = $query->verify($response, $_SERVER['REMOTE_ADDR']); $success = $query->verify($response, $_SERVER['REMOTE_ADDR']);
if (!$success) { if (!$success) {
error($config['error']['captcha']); error($config['error']['captcha']);
} }
} }
}
} catch (RuntimeException $e) { } catch (RuntimeException $e) {
if ($config['syslog']) { if ($config['syslog']) {
_syslog(LOG_ERR, "Captcha IO exception: {$e->getMessage()}"); _syslog(LOG_ERR, "Captcha IO exception: {$e->getMessage()}");