void DrawVerifySuccessView() { GUILayout.BeginArea(ContentSection); EditorGUILayout.BeginVertical(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Two-Factor Authentication enabled successfully. Please save the following recovery token: "); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(verify2FARecovery, new GUIStyle(GUI.skin.label) { fontSize = 20, fontStyle = FontStyle.Bold }); EditorGUILayout.EndHorizontal(); if (GUILayout.Button("Back", GUILayout.Height(20))) { currentView = LootLockerView.Login; } EditorGUILayout.EndVertical(); GUILayout.EndArea(); }
void DrawVerifyTwoFactorAuthView() { GUILayout.BeginArea(ContentSection); EditorGUILayout.BeginVertical(); EditorGUILayout.BeginHorizontal(); GUI.DrawTexture(new Rect((Screen.width / 2) - 100, 100, 200, 200), tfaTexture); EditorGUILayout.EndHorizontal(); if (GUILayout.Button("Back", GUILayout.Height(20))) { currentView = LootLockerView.Games; } EditorGUILayout.Separator(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Please scan the QR code on your Google Authenticator then enter your secret code"); //EditorGUILayout.LabelField("You can obtain it from google authenticator", new GUIStyle(GUI.skin.label) { fontSize = 10 }); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); verify2FASecret = EditorGUILayout.IntField(verify2FASecret); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Verify", GUILayout.Height(20))) { currentView = LootLockerView.Loading; LootLockerSDKAdminManager.VerifyTwoFactorAuthenticationSetup(verify2FASecret, (response) => { if (response.success) { Debug.LogError("Successfully verified two factor authentication setup: " + response.text); verify2FARecovery = response.recover_token; currentView = LootLockerView.VerifySuccess; } else { Debug.LogError("failed to set two factor authentication: " + response.Error); currentView = LootLockerView.Games; } }); } EditorGUILayout.EndHorizontal(); EditorGUILayout.EndVertical(); GUILayout.EndArea(); }
public void AdminLogin() { currentView = LootLockerView.Loading; LootLockerSDKAdminManager.InitialAuthRequest(email, password, (response) => { if (response.success) { Debug.Log("Successful got admin auth response: " + response.text); if (response.mfa_key != null) { mfaState = true; Debug.Log("the admin enabled 2fa"); StartTwoFA(response.mfa_key); } else { mfaState = false; Debug.Log("the admin didn't enable 2fa"); FinalAuth(response); } } else { ResetToLogin(); Debug.LogError("failed to get admin auth response: " + response.Error); } }); }
void StartTwoFA(string mFAKey) { MFAKey = mFAKey; SecretCode = String.Empty; currentView = LootLockerView.TwoFactorAuth; TwoFATockenTimoutCo = EditorCoroutineUtility.StartCoroutineOwnerless(TwoFATockenTimout()); }
void DrawRemoveTwoFactorAuthView() { GUILayout.BeginArea(ContentSection); EditorGUILayout.BeginVertical(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("To remove Two-Factor Authentication, Please enter a secret key from your Google Authenticator and click Remove"); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); remove2FASecret = EditorGUILayout.IntField(remove2FASecret); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Remove", GUILayout.Height(20))) { currentView = LootLockerView.Loading; LootLockerSDKAdminManager.RemoveTwoFactorAuthentication(remove2FASecret, (response) => { if (response.success) { Debug.Log("Successful removed 2fa: " + response.text); mfaState = false; currentView = LootLockerView.Games; } else { currentView = LootLockerView.Remove2FAConfirm; Debug.LogError("failed to get admin auth response: " + response.Error); } }); } EditorGUILayout.EndHorizontal(); if (GUILayout.Button("Back", GUILayout.Height(20))) { currentView = LootLockerView.Login; } EditorGUILayout.EndVertical(); GUILayout.EndArea(); }
public void AdminSetup2FA() { currentView = LootLockerView.Loading; LootLockerSDKAdminManager.SetupTwoFactorAuthentication((response) => { if (response.success) { Debug.LogError("Successful setup two factor authentication: " + response.text); tfaTexture = new Texture2D(200, 200); tfaTexture.LoadImage(Convert.FromBase64String(response.mfa_token_url.Substring(22))); currentView = LootLockerView.VerifyTwoFactorAuth; } else { Debug.LogError("failed to set two factor authentication: " + response.Error); ResetToLogin(); } }); }
void DrawTwoFactorAuthView() { GUILayout.BeginArea(ContentSection); EditorGUILayout.LabelField("Please Enter Your Secret Code"); EditorGUILayout.LabelField("You can obtain it from google authenticator", new GUIStyle(GUI.skin.label) { fontSize = 10 }); SecretCode = EditorGUILayout.TextField(SecretCode); if (GUILayout.Button("Submit")) { LootLockerSDKAdminManager.TwoFactorAuthVerification(MFAKey, SecretCode, (response) => { if (response.success) { Debug.Log("Successful 2FA: " + response.text); FinalAuth(response); } else { ResetToLogin(); Debug.LogError("failed to get admin auth response: " + response.Error); } }); } if (GUILayout.Button("Back", GUILayout.Height(20))) { currentView = LootLockerView.Login; } GUILayout.EndArea(); }
void ResetToLogin() { currentView = LootLockerView.Login; }
public void AdminRemove2FA() { currentView = LootLockerView.Remove2FAConfirm; }