def __loginUser(self, login, password):
        if hlp.is_none_or_empty(login):
            raise err.LoginError("User login cannot be empty.")
        user = self._session.query(db.User).get(login)
        if user is None:
            raise err.LoginError("User {} doesn't exist.".format(login))
        if user.password != password:
            raise err.LoginError("Password incorrect.")

        self._session.expunge(user)
        return user