From 630e2b21e4462a091df5732b331a4ea4fea58fae Mon Sep 17 00:00:00 2001 From: yggverse Date: Tue, 2 Apr 2024 18:24:37 +0300 Subject: [PATCH] add captcha settings --- example/config.json | 11 +++++++++++ src/webui/explore.php | 13 +++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/example/config.json b/example/config.json index 7526713..9324b30 100644 --- a/example/config.json +++ b/example/config.json @@ -125,6 +125,17 @@ "index": { "enabled":true + }, + "captcha": + { + "length":5, + "phrase":"0123456789abcdef", + "background": + { + "r":46, + "g":52, + "b":54 + } } }, "cli": diff --git a/src/webui/explore.php b/src/webui/explore.php index 4c620a9..51e62fc 100644 --- a/src/webui/explore.php +++ b/src/webui/explore.php @@ -215,8 +215,17 @@ if ($config->webui->index->enabled) ); } - $captcha = new \Gregwar\Captcha\CaptchaBuilder(); - $captcha->setBackgroundColor(46, 52, 54); + $captcha = new \Gregwar\Captcha\CaptchaBuilder( + $config->webui->captcha->length, + $config->webui->captcha->phrase + ); + + $captcha->setBackgroundColor( + $config->webui->captcha->background->r, + $config->webui->captcha->background->g, + $config->webui->captcha->background->b + ); + $captcha->build(); $_SESSION['captcha'] = $captcha->getPhrase();