コード例 #1
0
ファイル: Main.cs プロジェクト: Hertzole/unity-sdk
        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();
        }