I want verify the existing password for a user (to allow them to change their password).
I thought to go the following route but ran into the problem that the hashed password always shows up as a different hash. I am using UserPasswordHasherInterface
.
$hashedOldPassword = $passwordHasher->hashPassword(
$user,
$data['oldPassword']
);
if ($hashedOldPassword === $user->getPassword()) {
setNewPassword();
}