Example #1
0
 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);
 }
Example #2
0
 public void setPassword(String newValue) {
   passwordHash = Util.hash(newValue);
 }