feat(captcha): add ALTCHA configuration endpoint and integrate into HomeController
- Introduced a new endpoint `/api/v1/altcha/config` in CaptchaController to return the status of the ALTCHA captcha. - Updated HomeController to inject AltchaService and pass the captcha status to the home page template. - Modified the home.html.twig template to conditionally render the ALTCHA widget based on the captcha status. - Updated manifest.json and cache files to reflect changes in the codebase.
This commit is contained in:
@@ -22,4 +22,15 @@ class CaptchaController extends BaseController
|
||||
{
|
||||
return new JsonResponse($this->altcha->createChallenge());
|
||||
}
|
||||
|
||||
#[OA\Get(
|
||||
path: '/api/v1/altcha/config',
|
||||
summary: 'وضعیت فعال/غیرفعال بودن کپچا — کلاینتها بر اساس آن widget را رندر میکنند',
|
||||
responses: [new OA\Response(response: 200, description: '{ "enabled": bool }')]
|
||||
)]
|
||||
#[Route('/api/v1/altcha/config', methods: ['GET'])]
|
||||
public function config(): JsonResponse
|
||||
{
|
||||
return new JsonResponse(['enabled' => $this->altcha->enabled()]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user