handle login/logout scenarios