[Security] Check UserInterface::getPassword is not null before calling needsRehash

This commit is contained in:
dbrekelmans 2019-12-04 09:23:17 +01:00 committed by Robin Chalas
parent 70dec3c8a3
commit 8e4cf497cd

View File

@ -56,6 +56,10 @@ class UserPasswordEncoder implements UserPasswordEncoderInterface
*/
public function needsRehash(UserInterface $user): bool
{
if (null === $user->getPassword()) {
return false;
}
$encoder = $this->encoderFactory->getEncoder($user);
return method_exists($encoder, 'needsRehash') && $encoder->needsRehash($user->getPassword());