0
votes

In sf2.3 i am using fosuserbundle for usermanagement and sonataadminbundle for admin management.

When i try to create a new user in the admin i create the form field

->add('plainPassword');

But whenever i persist to the database the userbundle doesnt generate the encrypted password out of the plain password, which means it must be possible to use the usermanagement within the sonataadminbundle.

How to correct set password and persist the encrypted password to the database?

Thank you

1
Are you sure you want to integrate FOSUserBundle yourself and not use SonataUserBundle which does all hard work for you? Password saving is already set up correctly there. - TautrimasPajarskas
SonataUserBundle is not in sync with the current Head of sf 2.3 ... - user2485214

1 Answers

0
votes

I suspect you are not using the fos user manager to persist your object?

$userManager = $this->get('fos_user.user_manager');
$userManager->update($user,true);

The update method takes care of encrypting the passwords as well as several other items such as canocalizating the user name and email. The doc files have more information.