Answer the question
In order to leave comments, you need to log in
How to get or change user password (FOSUserBundle) in symfony 3.4?
Hello!
I need to make a list of users where the admin can edit any data of these users including passwords.
I installed and configured FOSUserBundle, but when I try to change plainPassword, I get an error:
An exception occurred while executing 'UPDATE fos_user SET pass = ?, password = ? WHERE id = ?' with params [null, "$2y$13$xfuD.3aPBh0oSNn2eCPf2eylUnM6807jFFgwfhYvkMnLTAZ9BIH1.", 5]:
SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'pass' cannot be null
class UserType extends AbstractType
{
/**
* {@inheritdoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('enabled', null, [
'required' => false,
'label' => 'Актианый',
])
->add('username')
->add('email')
// ->add('password')
->add('plainPassword')
->add('last_login', DateTimeType::class)
->add('roles', ChoiceType::class,
[
'label' => 'Группа',
'multiple' => true,
'choices' => [
'Зарегистрированный пользователь' => 'ROLE_USER',
'Администратор' => 'ROLE_SUPER_ADMIN',
]
]
)
;
}
/**
* {@inheritdoc}
*/
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults(array(
'data_class' => 'AppBundle\Entity\User'
));
}
/**
* {@inheritdoc}
*/
public function getBlockPrefix()
{
return 'appbundle_user';
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question