void Login() { ApiCredentials.Load(); APIUser.Login( delegate(APIUser user) { pipelineManager.user = user; ApiAvatar.Fetch(pipelineManager.blueprintId, false, delegate(ApiAvatar avatar) { apiAvatar = avatar; pipelineManager.completedSDKPipeline = !string.IsNullOrEmpty(apiAvatar.authorId); SetupUI(); }, delegate(string message) { apiAvatar = new ApiAvatar(); apiAvatar.id = pipelineManager.blueprintId; pipelineManager.completedSDKPipeline = false; SetupUI(); } ); }, LoginErrorCallback); }
void Login() { ApiCredentials.Load(); APIUser.Login( delegate(APIUser user) { pipelineManager.user = user; API.Fetch <ApiAvatar>(pipelineManager.blueprintId, (c) => { Debug.Log("<color=magenta>Updating an existing avatar.</color>"); apiAvatar = c.Model as ApiAvatar; pipelineManager.completedSDKPipeline = !string.IsNullOrEmpty(apiAvatar.authorId); SetupUI(); }, (c) => { Debug.Log("<color=magenta>Creating a new avatar.</color>"); apiAvatar = new ApiAvatar(); apiAvatar.id = pipelineManager.blueprintId; pipelineManager.completedSDKPipeline = !string.IsNullOrEmpty(apiAvatar.authorId); SetupUI(); }); }, LoginErrorCallback); }
void Login() { ApiCredentials.Load(); APIUser.Login( delegate(APIUser user) { pipelineManager.user = user; if (isUpdate) { ApiAvatar.Fetch(pipelineManager.blueprintId, false, delegate(ApiAvatar avatar) { apiAvatar = avatar; SetupUI(); }, delegate(string message) { apiAvatar = new ApiAvatar(); apiAvatar.id = pipelineManager.blueprintId; SetupUI(); }); } else { apiAvatar = new ApiAvatar(); apiAvatar.id = pipelineManager.blueprintId; SetupUI(); } }, LoginErrorCallback); }
new void Start() { if (!Application.isEditor || !Application.isPlaying) { return; } base.Start(); Application.runInBackground = true; UnityEngine.XR.XRSettings.enabled = false; uploadButton.onClick.AddListener(SetupUpload); shouldUpdateImageToggle.onValueChanged.AddListener(ToggleUpdateImage); releasePublic.gameObject.SetActive(false); ApiCredentials.Load(); APIUser.Login( delegate(APIUser user) { UserLoggedInCallback(user); }, delegate(string err) { VRC.Core.Logger.LogError("Could not log in - " + err, DebugLevel.Always); blueprintPanel.SetActive(false); errorPanel.SetActive(true); } ); }
new void Start() { if (!Application.isEditor || !Application.isPlaying) { return; } base.Start(); Application.runInBackground = true; UnityEngine.VR.VRSettings.enabled = false; uploadButton.onClick.AddListener(SetupUpload); shouldUpdateImageToggle.onValueChanged.AddListener(ToggleUpdateImage); releasePublic.gameObject.SetActive(false); ApiCredentials.Load(); APIUser.Login( delegate(APIUser user) { pipelineManager.user = user; UserLoggedInCallback(user); }, delegate(string err) { blueprintPanel.SetActive(false); errorPanel.SetActive(true); } ); }
public static void Init() { if (!RemoteConfig.IsInitialized()) { RemoteConfig.Init(); } if (isInitialized) { return; } if (!APIUser.IsLoggedInWithCredentials && ApiCredentials.Load()) { APIUser.Login(null, null); } clientInstallPath = SDKClientUtilities.GetSavedVRCInstallPath(); if (string.IsNullOrEmpty(clientInstallPath)) { clientInstallPath = SDKClientUtilities.LoadRegistryVRCInstallPath(); } signingIn = false; isInitialized = true; }
public static void Init() { if (!RemoteConfig.IsInitialized()) { RemoteConfig.Init(); } if (isInitialized) { return; } if (!APIUser.IsLoggedInWithCredentials && ApiCredentials.Load()) { APIUser.Login((user) => AnalyticsSDK.LoggedInUserChanged(user), null); } clientInstallPath = SDKClientUtilities.GetSavedVRCInstallPath(); if (string.IsNullOrEmpty(clientInstallPath)) { clientInstallPath = SDKClientUtilities.LoadRegistryVRCInstallPath(); } signingIn = false; isInitialized = true; VRCContentManagerWindow.ClearContent(); }
private static void SignIn(bool explicitAttempt) { lock (syncObject) { if (signingIn || APIUser.IsLoggedInWithCredentials || (!explicitAttempt && string.IsNullOrEmpty(storedUsername)) || (!explicitAttempt && string.IsNullOrEmpty(storedPassword))) { return; } signingIn = true; } Init(); 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"]); } 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) { signingIn = false; storedUsername = null; storedPassword = null; error = c.Error; VRC.Tools.ClearCookies(); APIUser.Logout(); refreshWindow = true; VRC.Core.Logger.Log("Error logging in: " + error); } ); }
// Token: 0x06005725 RID: 22309 RVA: 0x001E0584 File Offset: 0x001DE984 public static void Login(string usernameOrEmail, string password, Action <APIUser> successCallback = null, Action <string> errorCallback = null) { ApiCredentials.SetUser(usernameOrEmail, password); APIUser.Login(delegate(APIUser user) { User.mCurrentNonApiUser = new User(); User.mCurrentNonApiUser.Init(user); User.SetNetworkProperties(); if (successCallback != null) { successCallback(user); } }, errorCallback); }
// Token: 0x06005727 RID: 22311 RVA: 0x001E0604 File Offset: 0x001DEA04 public new static void Login(Action <APIUser> onFetchSuccess = null, Action <string> onFetchError = null) { ApiCredentials.Load(); APIUser.Login(delegate(APIUser freshAPIUser) { User.mCurrentNonApiUser = new User(); User.mCurrentNonApiUser.Init(APIUser.CurrentUser); User.SetNetworkProperties(); if (onFetchSuccess != null) { onFetchSuccess(freshAPIUser); } }, onFetchError); }
private static void AttemptLogin() { APIUser.Login(username, password, delegate(ApiModelContainer <APIUser> c) { APIUser user = c.Model as APIUser; if (c.Cookies.ContainsKey("twoFactorAuth")) { ApiCredentials.Set(user.username, username, "vrchat", c.Cookies["auth"], c.Cookies["twoFactorAuth"]); } else if (c.Cookies.ContainsKey("auth")) { ApiCredentials.Set(user.username, username, "vrchat", c.Cookies["auth"]); } else { ApiCredentials.SetHumanName(user.username); } signingIn = false; error = null; storedUsername = null; storedPassword = null; 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) { if (c.Cookies.ContainsKey("auth")) { ApiCredentials.Set(username, username, "vrchat", c.Cookies["auth"]); } showTwoFactorAuthenticationEntry = true; onAuthenticationVerifiedAction = OnAuthenticationCompleted; } ); }
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 SignIn(bool explicitAttempt) { lock (syncObject) { if (signingIn || APIUser.IsLoggedInWithCredentials || (!explicitAttempt && string.IsNullOrEmpty(storedUsername)) || (!explicitAttempt && string.IsNullOrEmpty(storedPassword))) { return; } signingIn = true; } Init(); ApiCredentials.Clear(); ApiCredentials.SetUser(username, password); APIUser.Login( delegate(APIUser user) { 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(); } } }, delegate(string message) { signingIn = false; storedUsername = null; storedPassword = null; error = message; APIUser.Logout(); VRC.Core.Logger.Log("Error logging in: " + message); } ); }
private static void SignIn(bool explicitAttempt) { lock (syncObject) { if (signingIn || APIUser.IsLoggedInWithCredentials || (!explicitAttempt && string.IsNullOrEmpty(storedUsername)) || (!explicitAttempt && string.IsNullOrEmpty(storedPassword))) { return; } signingIn = true; } Init(); ApiCredentials.Clear(); ApiCredentials.SetUser(username, password); APIUser.Login( delegate(APIUser user) { signingIn = false; error = null; storedUsername = username; storedPassword = password; AnalyticsSDK.LoggedInUserChanged(user); }, delegate(string message) { signingIn = false; storedUsername = null; storedPassword = null; error = message; APIUser.Logout(); VRC.Core.Logger.Log("Error logging in: " + message); } ); }
private static void AttemptLogin(string username = null, string password = null, Action successcallback = null) { if (selected_user_index >= add_index && (username == null || password == null)) { return; } if (username == null) { username = usernames[selected_user_index]; } if (password == null) { password = p_passwords[selected_user_index]; } signingIn = true; 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; EditorPrefs.SetString("sdk#username", username); EditorPrefs.SetString("sdk#password", password); AnalyticsSDK.LoggedInUserChanged(user); if (!APIUser.CurrentUser.canPublishAllContent) { if (UnityEditor.SessionState.GetString("HasShownContentPublishPermissionsDialogForUser", "") != user.id) { UnityEditor.SessionState.SetString("HasShownContentPublishPermissionsDialogForUser", user.id); VRCSdkControlPanel.ShowContentPublishPermissionsDialog(); } } ; if (successcallback != null) { successcallback.Invoke(); } AS_Window.RepaintActiveWindow(); }, delegate(ApiModelContainer <APIUser> c) { Logout(false); error = c.Error; VRC.Core.Logger.Log("Error logging in: " + error); AS_Window.RepaintActiveWindow(); }, delegate(ApiModelContainer <API2FA> c) { if (c.Cookies.ContainsKey("auth")) { ApiCredentials.Set(username, username, "vrchat", c.Cookies["auth"]); } AS_Window.showTwoFactorAuthenticationEntry = true; onAuthenticationVerifiedAction = OnAuthenticationCompleted; AS_Window.RepaintActiveWindow(); } ); }
bool OnGUIUserInfo() { if (!RemoteConfig.IsInitialized()) { RemoteConfig.Init(); } if (!APIUser.IsLoggedInWithCredentials && APIUser.IsCached) { APIUser.CachedLogin(null, null, false); } GUILayout.Label("Account Info", EditorStyles.boldLabel); if (APIUser.IsLoggedInWithCredentials) { GUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel("Logged in as " + APIUser.CurrentUser.displayName); if (GUILayout.Button("Logout")) { APIUser.Logout(); GUILayout.EndHorizontal(); return(false); } else { GUILayout.EndHorizontal(); GUILayout.Label("Developer Status: " + APIUser.CurrentUser.developerType); if (APIUser.CurrentUser.developerType == APIUser.DeveloperType.Internal) { string apiMessage = ApiModel.IsDevApi() ? "Dev" : "Release"; GUILayout.Label("API: " + apiMessage); } scrollPos = EditorGUILayout.BeginScrollView(scrollPos); EditorGUILayout.Space(); if (uploadedWorlds == null) { EditorGUILayout.EndScrollView(); return(true); } EditorGUILayout.LabelField("Worlds", EditorStyles.boldLabel); EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Name", EditorStyles.boldLabel, GUILayout.Width(200)); EditorGUILayout.LabelField("Image", EditorStyles.boldLabel, GUILayout.Width(75)); EditorGUILayout.LabelField("", EditorStyles.boldLabel, GUILayout.Width(50)); //EditorGUILayout.LabelField("Version", EditorStyles.boldLabel, GUILayout.Width (75)); EditorGUILayout.LabelField("Release Status", EditorStyles.boldLabel, GUILayout.Width(100)); EditorGUILayout.EndHorizontal(); List <ApiWorld> tmpWorlds = new List <ApiWorld>(); if (uploadedWorlds != null) { tmpWorlds = new List <ApiWorld>(uploadedWorlds); } foreach (ApiWorld w in tmpWorlds) { if (justDeletedContents != null && justDeletedContents.Contains(w.id)) { continue; } EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(w.name, GUILayout.Width(200)); if (worldImages != null && worldImages.ContainsKey(w.id)) { if (GUILayout.Button(worldImages[w.id], GUILayout.Height(100), GUILayout.Width(100))) { Application.OpenURL(w.imageUrl); } } else { GUILayout.Label("No Image", GUILayout.Height(100), GUILayout.Width(100)); } EditorGUILayout.LabelField("", EditorStyles.boldLabel, GUILayout.Width(50)); EditorGUILayout.LabelField(w.releaseStatus, GUILayout.Width(100)); EditorGUILayout.LabelField("", EditorStyles.boldLabel, GUILayout.Width(50)); if (GUILayout.Button("Copy ID", GUILayout.Width(75))) { TextEditor te = new TextEditor(); te.text = w.id; te.SelectAll(); te.Copy(); } if (GUILayout.Button("Delete", GUILayout.Width(75))) { if (EditorUtility.DisplayDialog("Delete " + w.name + "?", "Are you sure you want to delete " + w.name + "? This cannot be undone.", "Delete", "Cancel")) { ApiWorld.Delete(w.id, null, null); uploadedWorlds.RemoveAll(world => world.id == w.id); if (justDeletedContents == null) { justDeletedContents = new List <string>(); } justDeletedContents.Add(w.id); } } EditorGUILayout.EndHorizontal(); } EditorGUILayout.Space(); EditorGUILayout.LabelField("Avatars", EditorStyles.boldLabel); EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Name", EditorStyles.boldLabel, GUILayout.Width(200)); EditorGUILayout.LabelField("Image", EditorStyles.boldLabel, GUILayout.Width(75)); EditorGUILayout.EndHorizontal(); List <ApiAvatar> tmpAvatars = new List <ApiAvatar>(); if (uploadedAvatars != null) { tmpAvatars = new List <ApiAvatar>(uploadedAvatars); } foreach (ApiAvatar a in tmpAvatars) { if (justDeletedContents != null && justDeletedContents.Contains(a.id)) { continue; } EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(a.name, GUILayout.Width(200)); if (avatarImages != null && avatarImages.ContainsKey(a.id)) { if (GUILayout.Button(avatarImages[a.id], GUILayout.Height(100), GUILayout.Width(100))) { Application.OpenURL(a.imageUrl); } } else { GUILayout.Label("No Image", GUILayout.Height(100), GUILayout.Width(100)); } EditorGUILayout.LabelField("", EditorStyles.boldLabel, GUILayout.Width(50)); if (GUILayout.Button("Copy ID", GUILayout.Width(75))) { TextEditor te = new TextEditor(); te.text = a.id; te.SelectAll(); te.Copy(); } if (GUILayout.Button("Delete", GUILayout.Width(75))) { if (EditorUtility.DisplayDialog("Delete " + a.name + "?", "Are you sure you want to delete " + a.name + "? This cannot be undone.", "Delete", "Cancel")) { ApiAvatar.Delete(a.id, null, null); uploadedAvatars.RemoveAll(avatar => avatar.id == a.id); if (justDeletedContents == null) { justDeletedContents = new List <string>(); } justDeletedContents.Add(a.id); } } EditorGUILayout.EndHorizontal(); } EditorGUILayout.EndScrollView(); return(true); } } else { VRC.Core.ApiModel.ResetApi(); username = EditorGUILayout.TextField("Username", username); password = EditorGUILayout.PasswordField("Password", password); if (GUILayout.Button("Sign In")) { APIUser.Login(username, password, delegate(APIUser user) { UnityEditor.EditorUtility.ClearProgressBar(); FetchWorldData(); }, delegate(string message) { VRC.Core.Logger.Log("Error logging in - " + message); UnityEditor.EditorUtility.ClearProgressBar(); UnityEditor.EditorUtility.DisplayDialog("Error logging in", message, "Okay"); } ); UnityEditor.EditorUtility.DisplayProgressBar("Logging in!", "Hang tight...", 0.5f); } if (GUILayout.Button("Sign up")) { Application.OpenURL("http://www.vrchat.net/auth/register"); } return(false); } }