コード例 #1
0
    public void OnSubmitNewPassword()
    {
        //Sending the request with spaces for Username and Password so no errors are given and scriptData is sent
        //Response is breaken down and the result of the action is determined for debug or feedback to user
        GameSparks.Core.GSRequestData script = new GameSparks.Core.GSRequestData();

        script.Add("action", "resetPassword");
        script.Add("token", TokenInput.text);
        script.Add("password", NewPasswordInput.text);

        new AuthenticationRequest().SetUserName("").SetPassword("").SetScriptData(script).Send((response) => {
            if (response.HasErrors)
            {
                if (response.Errors.GetString("action") == "complete")
                {
                    GenericPopup popup = Backend.Utility.MakeNewGenericPopup("Success!", "Password changed. You will now be returned to the main menu.", false);
                    popup.OkButton.onClick.AddListener(() => SceneManager.Instance.LoadScene("TitleScreen"));

                    TokenInput.text       = "";
                    NewPasswordInput.text = "";
                }
                else
                {
                    Backend.Utility.MakeNewGenericPopup("Failed!", "Please ensure token is valid", false);
                }
            }
        });
    }
コード例 #2
0
    public void OnSubmitTokenRequest()
    {
        //Construction a GSRquestData object to pass in as scriptData

        GameSparks.Core.GSRequestData script = new GameSparks.Core.GSRequestData();

        script.Add("action", "passwordRecoveryRequest");
        script.Add("email", EmailAddress.text);


        //Sending the request with spaces for Username and Password so no errors are given and scriptData is sent
        //Response is breaken down and the result of the action is determined for debug or feedback to user
        new AuthenticationRequest().SetUserName("").SetPassword("").SetScriptData(script).Send((response) => {
            if (response.HasErrors)
            {
                if (response.Errors.GetString("action") == "complete")
                {
                    GenericPopup popup = Backend.Utility.MakeNewGenericPopup("Email sent!", "Check your email for a reset token.", false);
                    popup.OkButton.onClick.AddListener(() => StartCoroutine(TransitionBetweenCanvasGroups(ForgotPwdCanvasGroup, NewPwdCanvasGroup)));

                    EmailAddress.text = "";
                }
                else
                {
                    Backend.Utility.MakeNewGenericPopup("Email not sent!", "Please ensure email is linked to account", false);
                }
            }
        });
    }