[Ldap] Add missing LdapUser::setPassword()

This commit is contained in:
Robin Chalas 2019-08-20 22:58:33 +02:00
parent b7954640e3
commit 08dd4f3ae1
2 changed files with 8 additions and 5 deletions

View File

@ -90,6 +90,11 @@ class LdapUser implements UserInterface, EquatableInterface
return $this->extraFields;
}
public function setPassword(string $password)
{
$this->password = $password;
}
/**
* {@inheritdoc}
*/

View File

@ -125,11 +125,9 @@ class LdapUserProvider implements UserProviderInterface, PasswordUpgraderInterfa
}
try {
if ($user->isEqualTo($this->loadUserByUsername($user->getUsername()))) {
$user->getEntry()->setAttribute($this->passwordAttribute, [$newEncodedPassword]);
$this->ldap->getEntryManager()->update($user->getEntry());
$user->setPassword($newEncodedPassword);
}
$user->getEntry()->setAttribute($this->passwordAttribute, [$newEncodedPassword]);
$this->ldap->getEntryManager()->update($user->getEntry());
$user->setPassword($newEncodedPassword);
} catch (ExceptionInterface $e) {
// ignore failed password upgrades
}