示例#1
0
 protected virtual void dispatchCreateError(IRegisterResult result)
 {
     if (this.OnCreateError != null)
     {
         this.OnCreateError(result);
     }
 }
示例#2
0
        private void HandleRegisterSuccess(GuestControllerResult <LogInResponse> result, IEnumerable <Disney.Mix.SDK.Internal.GuestControllerDomain.MarketingItem> marketing, Action <IRegisterResult> callback)
        {
            IList <IInvalidProfileItemError> profileItemErrors = null;

            try
            {
                if (!result.Success)
                {
                    callback(new RegisterResult(success: false, null, null));
                    return;
                }
                IRegisterResult registerResult = GuestControllerErrorParser.GetRegisterResult(result.Response.error);
                if (registerResult != null)
                {
                    callback(registerResult);
                    return;
                }
                profileItemErrors = GuestControllerErrorParser.GetRegisterProfileItemErrors(result.Response.error);
                if (result.Response.data == null)
                {
                    if (result.Response.error != null && profileItemErrors == null)
                    {
                        logger.Critical("Received unhandled error exception" + JsonParser.ToJson(result.Response.error));
                    }
                    callback(new RegisterResult(success: false, null, profileItemErrors));
                    return;
                }
                LogInData loginData = result.Response.data;
                if (loginData.displayName == null || loginData.etag == null || loginData.profile == null || loginData.token == null || loginData.token.access_token == null)
                {
                    logger.Critical("Invalid login data:" + JsonParser.ToJson(loginData));
                    callback(new RegisterResult(success: false, null, profileItemErrors));
                    return;
                }
                loginData.profile.status = GuestControllerErrorParser.GetAccountStatusCode(result.Response.error, loginData.profile.status);
                string countryCode = GuestControllerUtils.GetCountryCode(loginData.profile);
                database.StoreSession(loginData.token.swid, loginData.token.access_token, loginData.token.refresh_token, loginData.displayName.displayName, loginData.profile.firstName, loginData.etag, loginData.profile.ageBand, loginData.displayName.proposedDisplayName, loginData.displayName.proposedStatus, loginData.profile.status, updateLastProfileRefreshTime: true, countryCode);
                mixSessionStarter.Start(loginData.token.swid, loginData.token.access_token, delegate
                {
                    HandleMixSessionStartSuccess(profileItemErrors, loginData.token.swid, loginData.profile, loginData.displayName, marketing, callback);
                }, delegate
                {
                    callback(new RegisterResult(success: false, null, profileItemErrors));
                });
            }
            catch (CorruptionException ex)
            {
                logger.Fatal("Corruption detected during registration: " + ex);
                callback(new RegisterCorruptionDetectedResult());
            }
            catch (Exception ex2)
            {
                logger.Critical("Unhandled exception: " + ex2);
                callback(new RegisterResult(success: false, null, profileItemErrors));
            }
        }
示例#3
0
        private void onMixCreateFailed(IRegisterResult result)
        {
            string tier = "unknown";
            List <IInvalidProfileItemError> list = new List <IInvalidProfileItemError>();

            if (result.Errors != null)
            {
                list.AddRange(result.Errors);
            }
            if (list.Count > 1)
            {
                tier = string.Join(", ", list.Select((IInvalidProfileItemError e) => e.ToString()).ToArray());
            }
            Service.Get <ICPSwrveService>().Action("game.account_creation.submit", "fail", tier);
        }
示例#4
0
        private void onCreateChildAccountComplete(IRegisterResult result)
        {
            string overrideMessage = (result.Success ? "success" : "fail");

            Service.Get <ICPSwrveService>().EndTimer("createtimer", null, overrideMessage);
            if (result.Success)
            {
                Service.Get <ICPSwrveService>().Action("game.account_creation.submit", "success");
                return;
            }
            string tier = "unknown";
            List <IInvalidProfileItemError> list = new List <IInvalidProfileItemError>();

            if (result.Errors != null)
            {
                list.AddRange(result.Errors);
            }
            if (list.Count > 1)
            {
                tier = string.Join(", ", list.Select((IInvalidProfileItemError e) => e.ToString()).ToArray());
            }
            Service.Get <ICPSwrveService>().Action("game.account_creation.submit", "fail", tier);
        }
 private void HandleOnCreateFailed(IRegisterResult result)
 {
     IntegrationTest.Fail("Create Request Failed");
 }
 private void onCreateFailed(IRegisterResult result)
 {
     dispatchCreateError(result);
 }
示例#7
0
 protected void onCreateChildAccountComplete(IRegisterResult value)
 {
     this.OnCreateChildAccountComplete.InvokeSafe(value);
 }
        private void onCreateError(IRegisterResult result)
        {
            string text = string.Empty;

            setButtonInteraction(ButtonState.disabled);
            if (result.Errors != null)
            {
                foreach (IInvalidProfileItemError error in result.Errors)
                {
                    object obj = text;
                    text = string.Concat(obj, "\t[", error, "]\n");
                    if (error is IInvalidUsernameError)
                    {
                        string tokenTranslation = Service.Get <Localizer>().GetTokenTranslation("Account.Create.Validation.InvalidUsername");
                        showUsernameError(tokenTranslation);
                    }
                    else if (error is IInvalidPasswordError || error is IPasswordMatchesOtherProfileInfoError || error is IPasswordUsesProfileInformationError)
                    {
                        string tokenTranslation = Service.Get <Localizer>().GetTokenTranslation("Account.Create.Validation.InvalidPassword");
                        showPasswordError(tokenTranslation);
                    }
                    else if (error is IInvalidParentEmailError)
                    {
                        string tokenTranslation = Service.Get <Localizer>().GetTokenTranslation("Account.Create.Validation.InvalidEmail");
                        showParentEmailError(tokenTranslation);
                    }
                    else if (error is IParentEmailBannedError)
                    {
                        string tokenTranslation = Service.Get <Localizer>().GetTokenTranslation("Account.Create.Validation.ParentEmailBanned");
                        showParentEmailError(tokenTranslation);
                    }
                    else if (error is IInvalidFirstNameError)
                    {
                        string tokenTranslation2 = Service.Get <Localizer>().GetTokenTranslation("Account.Create.Validation.EnterValid");
                        string tokenTranslation  = string.Format(tokenTranslation2, Service.Get <Localizer>().GetTokenTranslation("Account.Create.Validation.FirstNameField"));
                        showFirstNameError(tokenTranslation);
                    }
                    else if (error is IPasswordTooCommonError)
                    {
                        string tokenTranslation = Service.Get <Localizer>().GetTokenTranslation("Acount.Create.Validate.TooCommon");
                        showPasswordError(tokenTranslation);
                    }
                    else if (error is IPasswordSizeError)
                    {
                        string tokenTranslation = Service.Get <Localizer>().GetTokenTranslation("Account.Create.Validation.PasswordLength");
                        showPasswordError(tokenTranslation);
                    }
                    else if (error is IPasswordLikePhoneNumberError)
                    {
                        string tokenTranslation = Service.Get <Localizer>().GetTokenTranslation("Account.Create.Validation.PasswordPhoneNumber");
                        showPasswordError(tokenTranslation);
                    }
                    else if (error is IPasswordMissingExpectedCharactersError)
                    {
                        string tokenTranslation = Service.Get <Localizer>().GetTokenTranslation("Account.Create.Validation.PasswordComplexity");
                        showPasswordError(tokenTranslation);
                    }
                    else if (error is IRegisterRateLimitedResult)
                    {
                        string type   = "";
                        string format = "Account.General.Error.RateLimited";
                        Service.Get <EventDispatcher>().DispatchEvent(new ApplicationService.Error(type, format));
                    }
                    else if (error is IRegisterEmbargoedCountryResult || error is IRegisterGatedLocationResult)
                    {
                        string type   = "GlobalUI.Homescreen.GeoGate.Title";
                        string format = "GlobalUI.Homescreen.GeoGate.Body";
                        Service.Get <PromptManager>().ShowError(type, format);
                        showUsernameError(Service.Get <Localizer>().GetTokenTranslation(type));
                    }
                    else
                    {
                        string tokenTranslation = Service.Get <Localizer>().GetTokenTranslation("Account.Create.Validation.UnknownError");
                        showUsernameError(tokenTranslation);
                    }
                }
            }
            else
            {
                string type   = "Account.Create.Error.OneID.Title";
                string format = "Account.Create.Error.OneID";
                Service.Get <EventDispatcher>().DispatchEvent(new ApplicationService.Error(type, format));
            }
        }