Skip to content

Commit ec2131b

Browse files
committed
[Ldap] Add missing LdapUser::setPassword()
1 parent 834e798 commit ec2131b

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

Security/LdapUser.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,11 @@ public function getExtraFields(): array
9090
return $this->extraFields;
9191
}
9292

93+
public function setPassword(string $password)
94+
{
95+
$this->password = $password;
96+
}
97+
9398
/**
9499
* {@inheritdoc}
95100
*/

Security/LdapUserProvider.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,9 @@ public function upgradePassword(UserInterface $user, string $newEncodedPassword)
125125
}
126126

127127
try {
128-
if ($user->isEqualTo($this->loadUserByUsername($user->getUsername()))) {
129-
$user->getEntry()->setAttribute($this->passwordAttribute, [$newEncodedPassword]);
130-
$this->ldap->getEntryManager()->update($user->getEntry());
131-
$user->setPassword($newEncodedPassword);
132-
}
128+
$user->getEntry()->setAttribute($this->passwordAttribute, [$newEncodedPassword]);
129+
$this->ldap->getEntryManager()->update($user->getEntry());
130+
$user->setPassword($newEncodedPassword);
133131
} catch (ExceptionInterface $e) {
134132
// ignore failed password upgrades
135133
}

0 commit comments

Comments
 (0)