Implemented multiple captchas support. Implemented Yandex Smart Captcha support

This commit is contained in:
ErickSkrauch committed 2026-10-02 13:39:02 +02:00
1 parent a09c7a7035
commit b88d2cc2f6
31 files changed
+696 -299

No files matched your search

+8 -3
View File
@@ -1,8 +1,9 @@
<?php
namespace api\controllers;
use api\components\Captcha\CaptchaRegistry;
use api\components\Captcha\CaptchaValidator;
use api\filters\NginxCache;
use Yii;
use yii\helpers\ArrayHelper;
class OptionsController extends Controller {
@@ -27,9 +28,13 @@ class OptionsController extends Controller {
];
}
public function actionIndex(): array {
public function actionIndex(
CaptchaRegistry $captchaRegistry,
): array {
return [
'reCaptchaPublicKey' => Yii::$app->reCaptcha->public,
// Kept for backward compatibility, use captcha instead
'reCaptchaPublicKey' => $captchaRegistry->getProvider(CaptchaValidator::DEFAULT_TYPE)->getPublicParams()['publicKey'],
'captcha' => $captchaRegistry->getPublicParams(),
];
}