Captcha improvements

This commit is contained in:
Sascha Leib
2025-10-23 20:56:24 +02:00
parent 12993035b5
commit cdc02cd4c3
5 changed files with 286 additions and 25 deletions

View File

@@ -208,14 +208,16 @@ class action_plugin_botmon extends DokuWiki_Action_Plugin {
private function checkCaptchaCookie() {
$cookieVal = isset($_COOKIE['captcha']) ? $_COOKIE['captcha'] : null;
$cookieVal = isset($_COOKIE['DWConfirm']) ? $_COOKIE['DWConfirm'] : null;
$today = new DateTime();
$isodate = substr((new DateTime())->format('c'), 0, 10);
$today = substr((new DateTime())->format('c'), 0, 10);
$raw = $this->getConf('captchaSeed') . '|' . $_SERVER['SERVER_NAME'] . '|' . $_SERVER['REMOTE_ADDR'] . '|' . $isodate;
$raw = $this->getConf('captchaSeed') . '|' . $_SERVER['SERVER_NAME'] . '|' . $_SERVER['REMOTE_ADDR'] . '|' . $today;
$expected = hash('sha256', $raw);
return $cookieVal !== hash('sha256', $raw);
//echo '<ul><li>cookie: ' . $cookieVal . '</li><li>expected: ' . $expected . '</li><li>matches: ' .($cookieVal == $expected ? 'true' : 'false') . '</li></ul>';
return $cookieVal !== $expected;
}
private function insertCaptchaLoader() {