If you want to verify that a submitted password matches an encrypted (hashed) password you would use
passwordEncoder.matches(rawEnteredPassword, storedEncryptedPassword)
(assuming that passwordEncoder
is a Spring PasswordEncoder)
If you are however trying to verify that the password and the password confirmation are equal (if the user enters both passwords at the same time) you could just use
Objects.equals(resetDTO.getPassword(), resetDTO.getConfirmPassword())
solved Compare passwords [closed]