public boolean checkPassword(String password) { if (passwordHash == null) { throw new IllegalStateException("User password is not set"); } if (password == null) { throw new IllegalArgumentException("Null password passed to User.checkPassword"); } String hash = Util.hash(password); return hash.equals(passwordHash); }
public void setPassword(String newValue) { passwordHash = Util.hash(newValue); }