Skip to content

Commit 139e608

Browse files
committed
Change the way to reset the plain password after hashing it
The PasswordUpdater implementation resets the plain password to `null` after hashing the password, marking the fact that a next code (done in a Doctrine listener for instance) would not need to hash anything anymore. Instead of relying on `UserInterface::eraseCredentials` which is deprecated in Symfony 7.3+ and not guaranteed to implement this behavior if the entity overrides the method, the `null` is now set explicitly.
1 parent 607a7fb commit 139e608

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/Util/HashingPasswordUpdater.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,6 @@ public function hashPassword(UserInterface $user): void
5050
}
5151

5252
$user->setPassword($hashedPassword);
53-
$user->eraseCredentials();
53+
$user->setPlainPassword(null);
5454
}
5555
}

0 commit comments

Comments
 (0)