Commit e5cec638 by Julien Jorry

Fix : bug in user creation in PROD with no password

parent c3e0f943
......@@ -26,6 +26,7 @@ use Sonata\CoreBundle\Form\Type\DatePickerType;
use Sonata\UserBundle\Admin\Model\UserAdmin as BaseUserAdmin;
use Sonata\UserBundle\Form\Type\SecurityRolesType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Extension\Core\Type\LocaleType;
use Symfony\Component\Form\Extension\Core\Type\PasswordType;
use Symfony\Component\Form\Extension\Core\Type\RepeatedType;
......@@ -193,6 +194,14 @@ class UserAdmin extends BaseUserAdmin
'required' => (!$this->getSubject() || null === $this->getSubject()->getId()),
))
;
} else {
$formMapper
->add('plainPassword', HiddenType::class, [
'data' => random_bytes(10),
'required' => false,
'validation_groups' => false
])
;
}
$formMapper->end()
->with('Profile')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment