Refactor captcha check function

This commit is contained in:
Alma Armas 2020-12-31 21:21:55 +00:00
parent ea6f1f8dfc
commit 8bb31718d1

View file

@ -94,11 +94,14 @@ class CaptchaManager
return $image; return $image;
} }
function verifyCaptcha(string $input): bool function verifyCaptcha(?string $input = NULL): bool
{ {
if(!COMMITCAPTCHA_ROOT_CONF["commitcaptcha"]["enable"]) if(!COMMITCAPTCHA_ROOT_CONF["commitcaptcha"]["enable"])
return true; return true;
if(!$input)
$input = $_POST["captcha"];
$data = $this->session->get("captcha"); $data = $this->session->get("captcha");
if(!$data) if(!$data)
return false; return false;