feat(altcha): add altcha validation layer to login
Some checks are pending
Cadoles/hydra-sql/pipeline/pr-develop Build started...

This commit is contained in:
2025-03-24 17:20:17 +01:00
parent 1cb5ae6bc3
commit 12523398f6
51 changed files with 2417 additions and 1137 deletions

View File

@ -2,8 +2,10 @@
namespace App\Form;
use App\Altcha\Form\AltchaType;
use App\Flag\FlagAccessor;
use App\Flag\FlagEnum;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\PasswordType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
@ -11,6 +13,12 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
class LoginType extends AbstractType
{
public function __construct(
private readonly FlagAccessor $flagAccessor,
private readonly bool $altchaEnabled
) {
}
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
@ -22,12 +30,15 @@ class LoginType extends AbstractType
'translation_domain' => 'form',
'label' => 'form.label.password',
])
->add('_remember_me', CheckboxType::class, [
'required' => false,
'translation_domain' => 'form',
'label' => 'form.label.remember_me',
])
;
if ($this->flagAccessor->isFlagEnabled(FlagEnum::Altcha, $this->altchaEnabled)) {
$builder->add('altcha', AltchaType::class, [
'translation_domain' => 'form',
'label' => 'altcha.widget.title',
'required' => true,
]);
}
}
public function configureOptions(OptionsResolver $resolver): void