implemented the login, logout functions