Ejemplo n.º 1
0
  static boolean authenticate(String username, String password) {
    User user = User.find("byLoginName", username).first();

    if (user == null) {
      return false;
    }
    if (user.getEncryption() == User.Encryption.MD5) {
      return DigestUtils.md5Hex(password).equals(user.getPassword());
    }
    return BCrypt.checkpw(password, user.getPassword());
  }