@Override
    public Result<Long> authenticate(String username, String password) {
        UsersDAO dao = new UsersDAO(getDBConnection());
        try {
            if (!checkLoginPassword(username, password)) return new Result<>(-1L, ExceptionMessages.EMPTY_DATA);
            UserDataSet user = dao.getUser(username);
            if (user == null) return new Result<>(-1L, ExceptionMessages.NO_SUCH_USER_FOUND);
            if (!user.getPassword().equals(password)) return new Result<>(-1L, ExceptionMessages.FAILED_AUTH);
            return new Result<>(user.getUserId(), AccountServiceMessages.AUTHORIZED);
        } catch (SQLException e) {
            e.printStackTrace();
            return new Result<>(-1L, ExceptionMessages.SQL_ERROR);
        }
    }