I have password which is hashed in database while saving it. But I am now implementing login module and not able to compare two passwords in spring [boot] data jpa. This is trying comparing text password that I enter to the password that is hashed in database which obviously fails.
I know this has been answered here using java for general case but not for spring boot.
I somehow need to manipulate logic in this code
@Override
public boolean getLoggedinUser(User user) {
String uname = user.getUsername();
String email = user.getEmail();
String password = user.getPassword();
System.out.println("sanity check username----- " + uname +
" password ------- " + password);
if ((userRepo.findByUsername(uname) != null && userRepo.findByPassword(password) != null)
|| (userRepo.findByPassword(password) != null && userRepo.findByEmail(email) != null)) {
return true;
}
else return false;
}
Now, how to compare them ? Any solution is appreciated.