Revived API POST /api/v1/captcha.
Captcha validation has been adjusted.
This commit is contained in:
@@ -10,13 +10,24 @@ use Illuminate\Support\Str;
|
||||
|
||||
final readonly class CaptchaLogHandler
|
||||
{
|
||||
public function handleStore(Captcha $captcha, CaptchaLogType $captchaLogType, HttpUserData $httpUserData): CaptchaLog
|
||||
public function handleStore(int $captchaId, CaptchaLogType $captchaLogType, HttpUserData $httpUserData): CaptchaLog
|
||||
{
|
||||
return $captcha->captchaLogs()->create([
|
||||
$userAgent = $httpUserData->getUserAgent();
|
||||
if (!is_null($userAgent)) {
|
||||
$userAgent = Str::limit($userAgent, 255, '');
|
||||
}
|
||||
|
||||
$referer = $httpUserData->getReferer();
|
||||
if (!is_null($referer)) {
|
||||
$referer = Str::limit($referer, 10000, '');
|
||||
}
|
||||
|
||||
return CaptchaLog::create([
|
||||
'captcha_id' => $captchaId,
|
||||
'type' => $captchaLogType,
|
||||
'ip' => $httpUserData->getClientIp(),
|
||||
'user_agent' => Str::limit($httpUserData->getUserAgent(), 255, ''),
|
||||
'referer' => Str::limit($httpUserData->getReferer(), 10000, ''),
|
||||
'user_agent' => $userAgent,
|
||||
'referer' => $referer,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user