commitcaptcha/bootstrap.php

23 lines
640 B
PHP
Raw Normal View History

2020-06-17 18:37:12 +03:00
<?php declare(strict_types=1);
2020-07-10 16:54:28 +03:00
use commitcaptcha\CaptchaManager;
2020-06-17 18:37:12 +03:00
function captcha_template(): string
{
$html = <<<'HTML'
<div class="captcha">
2020-07-10 16:54:28 +03:00
<img src="/commitcaptcha/captcha.webp" alt="Captcha" style="margin-bottom: 8px; width: 130px;" />
2020-06-17 18:37:12 +03:00
<br/>
<input type="text" name="captcha" placeholder="Enter 8 characters" />
</div>
HTML;
2020-07-10 16:54:28 +03:00
return COMMITCAPTCHA_ROOT_CONF["commitcaptcha"]["enable"] ? $html : "You have already verified that you are not a robot.";
2020-06-17 18:37:12 +03:00
}
function check_captcha(?string $input): bool
{
return CaptchaManager::i()->verifyCaptcha((string) $input);
}
2020-07-10 16:54:28 +03:00
return (function() {});