mirror of
https://github.com/elyby/accounts.git
synced 2026-10-20 12:48:07 +05:30
43 lines
1.2 KiB
PHP
43 lines
1.2 KiB
PHP
<?php
|
|
namespace api\controllers;
|
|
|
|
use api\components\Captcha\CaptchaRegistry;
|
|
use api\components\Captcha\CaptchaValidator;
|
|
use api\components\Captcha\Providers\ProviderInterface;
|
|
use api\filters\NginxCache;
|
|
use yii\helpers\ArrayHelper;
|
|
|
|
class OptionsController extends Controller {
|
|
|
|
public function behaviors(): array {
|
|
return ArrayHelper::merge(parent::behaviors(), [
|
|
'authenticator' => [
|
|
'except' => ['index'],
|
|
],
|
|
'nginxCache' => [
|
|
'class' => NginxCache::class,
|
|
'rules' => [
|
|
'index' => 3600, // 1h
|
|
],
|
|
],
|
|
]);
|
|
}
|
|
|
|
public function verbs() {
|
|
return [
|
|
'index' => ['GET'],
|
|
];
|
|
}
|
|
|
|
public function actionIndex(
|
|
CaptchaRegistry $captchaRegistry,
|
|
): array {
|
|
return [
|
|
// Kept for backward compatibility, use captcha instead
|
|
'reCaptchaPublicKey' => $captchaRegistry->getProvider(CaptchaValidator::DEFAULT_TYPE)->getPublicParams()[ProviderInterface::PUBLIC_KEY_PARAM],
|
|
'captcha' => $captchaRegistry->getPublicParams(),
|
|
];
|
|
}
|
|
|
|
}
|