Skip to content

Commit 543e401

Browse files
bug #33263 [Ldap] Add missing LdapUser::setPassword() (chalasr)
This PR was merged into the 4.4 branch. Discussion ---------- [Ldap] Add missing LdapUser::setPassword() | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - Required for password migrations. Commits ------- 08dd4f3 [Ldap] Add missing LdapUser::setPassword()
2 parents af6cf31 + 08dd4f3 commit 543e401

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

src/Symfony/Component/Ldap/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
*/

src/Symfony/Component/Ldap/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)