Revived API POST /api/v1/captcha.

Captcha validation has been adjusted.
This commit is contained in:
2023-11-26 15:09:42 +06:00
parent 18899c81f2
commit 520a3ba068
21 changed files with 365 additions and 12 deletions

View File

@@ -2,6 +2,7 @@
namespace App\Repositories;
use App\Dto\Repository\DataCaptchaRepository\DataCaptcha;
use App\Exceptions\Repositories\DataCaptchaRepositoryException;
use App\Models\Captcha;
use App\Services\GenerateTokenCommand\GenerateTokenUlidCommand;
@@ -28,4 +29,22 @@ final readonly class DataCaptchaRepository
return $key;
}
public function getByKey(string $key): ?DataCaptcha
{
$dataCaptcha = Cache::driver('redis')->get($key);
if (is_null($dataCaptcha)) {
return null;
}
return new DataCaptcha(
captchaId: $dataCaptcha['id'],
coordinators: $dataCaptcha['coordinators'],
);
}
public function destroy(string $key): void
{
Cache::driver('redis')->delete($key);
}
}