简体   繁体   中英

encrypted password with sonataadminbundle and fosuserbundle

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM