Closed
Description
Encoding a user's password currently looks like this:
$encoder = $this->container->get('security.encoder_factory')
->getEncoder($user)
;
$encoded = $encoder->encodePassword($plainPassword, $user->getSalt());
$user->setPassword($encoded);
I'd like to make this easier. How about:
$encoded = $this->container->get('security.password_encoder')
->encodePassword($user, $plainPassword);
$user->setPassword($encoded);
The security.password_encoder
would be a new service. It would use the $user
to get the correct encoder and the getSalt
method (which is on UserInterface
to get the salt. Done! Hopefully I'm not overlooking anything :).
Thanks!
Metadata
Metadata
Assignees
Labels
DX = Developer eXperience (anything that improves the experience of using Symfony)DX = Developer eXperience (anything that improves the experience of using Symfony)