コード例 #1
0
ファイル: QDChangePassword.cs プロジェクト: TobiHatti/Q-Drive
        private void Submit()
        {
            if (!NoOldPassword && OldPassword != txbOldPassword.Text)
            {
                MessageBox.Show("Old password is not valid.", "Invalid password", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (!QDLib.ValidatePasswords(txbNewPassword.Text, txbConfirmNewPassword.Text))
            {
                return;
            }

            NewPassword = txbNewPassword.Text;

            this.DialogResult = DialogResult.OK;
            this.Close();
        }
コード例 #2
0
        private void Submit()
        {
            if (EditID == null || (EditID != null && !string.IsNullOrEmpty(txbPassword.Text) && !string.IsNullOrEmpty(txbConfirmPassword.Text)))
            {
                if (!QDLib.ValidatePasswords(txbPassword.Text, txbConfirmPassword.Text))
                {
                    return;
                }
            }

            if (string.IsNullOrEmpty(txbDisplayName.Text))
            {
                MessageBox.Show("Please enter a valid display-name.", "Invalid Display-Name", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (string.IsNullOrEmpty(txbUsername.Text))
            {
                MessageBox.Show("Please enter a valid username.", "Invalid Username", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (EditID == null || (EditID != null && Username != txbUsername.Text))
            {
                using (WrapMySQL mysql = new WrapMySQL(DBData))
                {
                    if (mysql.ExecuteScalarACon <int>("SELECT COUNT(*) FROM qd_users WHERE Username = ?", txbUsername.Text) != 0)
                    {
                        MessageBox.Show("Username already in use. Please choose another username", "Username already in use", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }
                }
            }

            DisplayName = txbDisplayName.Text;
            Username    = txbUsername.Text;

            if (EditID == null || (EditID != null && !string.IsNullOrEmpty(txbPassword.Text) && !string.IsNullOrEmpty(txbConfirmPassword.Text)))
            {
                Password = txbPassword.Text;
            }

            this.DialogResult = DialogResult.OK;
            this.Close();
        }
コード例 #3
0
        private void SubmitSA2()
        {
            QDLoader qdLoader = new QDLoader();

            qdLoader.Show();

            alwaysPromptPassword = chbSA2PromptPassword.Checked;

            if (alwaysPromptPassword)
            {
                // Check if both passwords are valid
                if (QDLib.ValidatePasswords(txbSA2Password.Text, txbSA2ConfirmPassword.Text))
                {
                    localPassword = txbSA2Password.Text;
                }
                else
                {
                    qdLoader.Close();
                    return;
                }
            }

            // (Try to) save the QD-Config and create DBs
            SaveConfiguration(localConnection);

            // Check if an error occured and show error-page
            if (!errorEncountered)
            {
                pnlS3Finish.BringToFront();
            }
            else
            {
                pnlS3Error.BringToFront();
                btnS3ErrorClose.Focus();
            }

            qdLoader.Close();
        }
コード例 #4
0
        private void SubmitSB2B()
        {
            QDLoader qdLoader = new QDLoader();

            qdLoader.Show();

            if (rbnSB2ExistingDB.Checked)
            {
                if (!QDLib.VerifyMasterPassword(txbSB2ExistingDBPassword.Text, onlineDBConDat))
                {
                    qdLoader.Close();
                    MessageBox.Show("Master-Password is not valid. Please enter the corrent Master-Password, which has been set when the database was first initialised.", "Invalid Master-Password", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                else
                {
                    onlineMasterPassword = txbSB2ExistingDBPassword.Text;
                }
            }
            else
            {
                if (QDLib.ValidatePasswords(txbSB2NewDBPassword.Text, txbSB2NewDBConfirmPassword.Text))
                {
                    onlineMasterPassword = txbSB2NewDBPassword.Text;
                }
                else
                {
                    qdLoader.Close();
                    return;
                }

                if (onlineAlreadyConfigured)
                {
                    if (MessageBox.Show("The given database has already been initialised before. Do you really want to delete the existing database and configure it as a new one?", "Database already initialised", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
                    {
                        VerifyMasterPW verify = new VerifyMasterPW()
                        {
                            DBData = onlineDBConDat
                        };

                        if (verify.ShowDialog() != DialogResult.OK)
                        {
                            qdLoader.Close();
                            return;
                        }
                    }
                    else
                    {
                        qdLoader.Close();
                        return;
                    }
                }
            }

            alwaysPromptPassword   = chbS2B2PromptUserPassword.Checked;
            onlineConfigureAsNewDB = rbnSB2NewDB.Checked;

            SaveConfiguration(localConnection);

            if (!errorEncountered)
            {
                pnlS3Finish.BringToFront();
            }
            else
            {
                pnlS3Error.BringToFront();
                btnS3ErrorClose.Focus();
            }

            qdLoader.Close();
        }