feat(altcha): add altcha validation layer to login
Some checks are pending
Cadoles/hydra-sql/pipeline/pr-develop Build started...
Some checks are pending
Cadoles/hydra-sql/pipeline/pr-develop Build started...
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user