Beispiel #1
0
        private void OnLoggedOn(SteamUser.LoggedOnCallback obj)
        {
            // we might need to sort out authentication/2fa codes
            var isAuthApp   = obj.Result == EResult.AccountLoginDeniedNeedTwoFactor;
            var isAuthEmail = obj.Result == EResult.AccountLogonDenied;

            if (isAuthApp || isAuthEmail)
            {
                if (isAuthEmail)
                {
                    Debug.WriteLine($"Email authentication code required.");
                    ShowLogin(AUTH_MODE.EMAIL, "Enter the code sent to your email.");
                }
                else
                {
                    Debug.WriteLine($"App authentication code required.");
                    ShowLogin(AUTH_MODE.APP, "Enter SteamGuard code from your app.");
                }

                return;
            }

            // something went wrong
            if (obj.Result != EResult.OK)
            {
                AUTH_MODE auth = AUTH_MODE.NONE;
                if (authCode != null && emailCode == null)
                {
                    auth = AUTH_MODE.APP;
                }
                else if (authCode == null && emailCode != null)
                {
                    auth = AUTH_MODE.EMAIL;
                }
                ShowLogin(auth, $"Unable to login ({obj.Result})");

                Debug.WriteLine($"Unable to logon to Steam: {obj.Result} / {obj.ExtendedResult}");
                loginStatus = LOGIN_STATUS.FAIL;
                return;
            }

            while (friends.GetPersonaName() == null)
            {
            }
            CloseLogin();
            Debug.WriteLine("Successfully logged into steam! Welcome, " + friends.GetPersonaName());

            if (!background)
            {
                ShowDialogNotice($"Successfully logged into steam! Welcome, {friends.GetPersonaName()}.");
            }

            loginStatus = LOGIN_STATUS.SUCCESS;

            steamID = obj.ClientSteamID;
        }
Beispiel #2
0
        public void UpdateStage(AUTH_MODE authMode, string error)
        {
            this.authMode = authMode;

            this.lbl_error.Content = error;

            this.lbl_auth.Visibility = authMode != AUTH_MODE.NONE ? Visibility.Visible : Visibility.Hidden;
            this.txt_auth.Visibility = authMode != AUTH_MODE.NONE ? Visibility.Visible : Visibility.Hidden;

            IsEnabled = true;
        }
Beispiel #3
0
        public void ShowLogin(AUTH_MODE auth, string error)
        {
            if (background)
            {
                return;
            }

            Application.Current.Dispatcher.Invoke((Action) delegate {
                if (loginWindow == null)
                {
                    loginWindow = new Login();
                }
                loginWindow.UpdateStage(auth, error);
                loginWindow.ShowAsync();
            });
        }
        // 권한체크
        public static bool AuthCheck(string menu_id, AUTH_MODE mode, string email)
        {
            string field_name = "";

            if (mode == AUTH_MODE.AUTH_SEARCH)
            {
                field_name = "PER_SELECT";  // 조회(select)
            }
            else if (mode == AUTH_MODE.AUTH_REGISTER)
            {
                field_name = "PER_INSERT";  // 등록(insert)
            }
            else if (mode == AUTH_MODE.AUTH_UPDATE)
            {
                field_name = "PER_UPDATE";  // 수정(update)
            }
            else if (mode == AUTH_MODE.AUTH_DELETE)
            {
                field_name = "PER_DELETE";  // 삭제(delete)
            }
            else
            {
                return(false);
            }

            string sql1 = "select "
                          + field_name
                          + " from est_group_permission"
                          + string.Format(" where GROUP_ID=(select GROUP_ID from est_user where EMAIL='{0}')", email)
                          + string.Format(" and EST_CODE=(select EST_CODE from est_user where EMAIL='{0}')", email)
                          + string.Format(" and MENU_ID='{0}'", menu_id)
                          + "";

            string    err1 = "";
            DataTable dt1  = DatabaseConnection.GetDataTableMySQL(sql1, out err1);

            if (dt1 == null || dt1.Rows.Count == 0)
            {
                return(false);
            }



            int permission = int.Parse(dt1.Rows[0][field_name].ToString().Trim());

            return((permission == 1) ? true : false);
        }