mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 14:43:49 +00:00
main: allow creation of user without password
This commit is contained in:
@@ -19,6 +19,7 @@ use Chill\MainBundle\Form\Type\PickCivilityType;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\EmailType;
|
||||
@@ -35,9 +36,14 @@ class UserType extends AbstractType
|
||||
{
|
||||
private TranslatableStringHelper $translatableStringHelper;
|
||||
|
||||
public function __construct(TranslatableStringHelper $translatableStringHelper)
|
||||
{
|
||||
protected ParameterBagInterface $parameterBag;
|
||||
|
||||
public function __construct(
|
||||
TranslatableStringHelper $translatableStringHelper,
|
||||
ParameterBagInterface $parameterBag
|
||||
) {
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
$this->parameterBag = $parameterBag;
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
@@ -105,7 +111,7 @@ class UserType extends AbstractType
|
||||
},
|
||||
]);
|
||||
|
||||
if ($options['is_creation']) {
|
||||
if ($options['is_creation'] && $this->parameterBag->get('chill_main.access_user_change_password')) {
|
||||
$builder->add('plainPassword', RepeatedType::class, [
|
||||
'mapped' => false,
|
||||
'type' => PasswordType::class,
|
||||
|
Reference in New Issue
Block a user