Ejemplo n.º 1
0
        private static void Login()
        {
            APIUser.Login(username, password,
                          delegate(ApiModelContainer <APIUser> c)
            {
                APIUser user = c.Model as APIUser;
                if (c.Cookies.ContainsKey("auth"))
                {
                    ApiCredentials.Set(user.username, username, "vrchat", c.Cookies["auth"]);
                }
                else
                {
                    ApiCredentials.SetHumanName(user.username);
                }
                signingIn      = false;
                error          = null;
                storedUsername = username;
                storedPassword = password;
                AnalyticsSDK.LoggedInUserChanged(user);

                if (!APIUser.CurrentUser.canPublishAllContent)
                {
                    if (UnityEditor.SessionState.GetString("HasShownContentPublishPermissionsDialogForUser", "") != user.id)
                    {
                        UnityEditor.SessionState.SetString("HasShownContentPublishPermissionsDialogForUser", user.id);
                        VRC_SdkControlPanel.ShowContentPublishPermissionsDialog();
                    }
                }

                refreshWindow = true;
            },
                          delegate(ApiModelContainer <APIUser> c)
            {
                Logout();
                error = c.Error;
                VRC.Core.Logger.Log("Error logging in: " + error);
            },
                          delegate(ApiModelContainer <API2FA> c)
            {
                API2FA model2FA = c.Model as API2FA;
                if (c.Cookies.ContainsKey("auth"))
                {
                    ApiCredentials.Set(username, username, "vrchat", c.Cookies["auth"]);
                }
                enter2faWindow = EditorWindow.GetWindow <Enter2faCodeEditorWindow>("VRChat 2FA");
                enter2faWindow.SetCredentialsAndVerificationHandling(username, password, OnAuthenticationCompleted);
                enter2faWindow.Show();
            }
                          );
        }
    private static void AttemptLogin()
    {
        APIUser.Login(username, password,
                      delegate(ApiModelContainer <APIUser> c)
        {
            APIUser user = c.Model as APIUser;
            if (c.Cookies.ContainsKey("auth"))
            {
                ApiCredentials.Set(user.username, username, "vrchat", c.Cookies["auth"]);
            }
            else
            {
                ApiCredentials.SetHumanName(user.username);
            }
            signingIn      = false;
            error          = null;
            storedUsername = username;
            storedPassword = password;
            AnalyticsSDK.LoggedInUserChanged(user);

            if (!APIUser.CurrentUser.canPublishAllContent)
            {
                if (UnityEditor.SessionState.GetString("HasShownContentPublishPermissionsDialogForUser", "") != user.id)
                {
                    UnityEditor.SessionState.SetString("HasShownContentPublishPermissionsDialogForUser", user.id);
                    VRCSdkControlPanel.ShowContentPublishPermissionsDialog();
                }
            }
        },
                      delegate(ApiModelContainer <APIUser> c)
        {
            Logout();
            error = c.Error;
            VRC.Core.Logger.Log("Error logging in: " + error);
        },
                      delegate(ApiModelContainer <API2FA> c)
        {
            API2FA model2FA = c.Model as API2FA;
            if (c.Cookies.ContainsKey("auth"))
            {
                ApiCredentials.Set(username, username, "vrchat", c.Cookies["auth"]);
            }
            showTwoFactorAuthenticationEntry = true;
            onAuthenticationVerifiedAction   = OnAuthenticationCompleted;
        }
                      );
    }