Exemple #1
0
        private void bPassword_Click(object sender, EventArgs e)
        {
            if (tbGPassword.Text.Trim() == "")
            {
                MessageBox.Show(this, "Password can't be empty", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                tbGPassword.Text = "";
                tbGConfirm.Text  = "";
            }
            else if (tbGConfirm.Text != tbGPassword.Text)
            {
                MessageBox.Show(this, "Password confirmation doesn't match", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                tbGConfirm.Text = "";
            }
            else
            {
                if (Settings.Default.password != tbGPassword.Text)
                {
                    Settings.Default.password = tbGPassword.Text;
                    mainform.XmlConfigSet("password", mainform.Encrypt(Settings.Default.password, Settings.Default.pcryptkey));

                    string[] bwArgs = { "recrypt", Settings.Default.password };
                    bwProgress.RunWorkerAsync(bwArgs);
                    recryptpopup      = new popupRecrypt(this);
                    recryptpopup.Text = "Applying" + recryptpopup.Text;
                    recryptpopup.ShowDialog(this);

                    Settings.Default.cryptkey = Settings.Default.password;
                }
                bGPassword.Enabled = false;
            }
        }
Exemple #2
0
        private void cbGPassword_CheckedChanged(object sender, EventArgs e)
        {
            if (cbGPassword.Checked)
            {
                tbGPassword.Enabled = true;
                tbGConfirm.Enabled  = true;
            }
            else
            {
                if (Settings.Default.password != "")
                {
                    string[] bwArgs = { "recrypt", Settings.Default.ocryptkey };
                    bwProgress.RunWorkerAsync(bwArgs);
                    recryptpopup      = new popupRecrypt(this);
                    recryptpopup.Text = "Removing" + recryptpopup.Text;
                    recryptpopup.ShowDialog(this);

                    mainform.XmlDropNode("ID='password'");
                    Settings.Default.password = "";
                    Settings.Default.cryptkey = Settings.Default.ocryptkey;
                }

                tbGPassword.Enabled = false;
                tbGPassword.Text    = "";
                tbGConfirm.Enabled  = false;
                tbGConfirm.Text     = "";
                bGPassword.Enabled  = false;
            }
        }
        private void cbGPassword_CheckedChanged(object sender, EventArgs e)
        {
            if (cbGPassword.Checked)
            {
                tbGPassword.Enabled = true;
                tbGConfirm.Enabled = true;
            }
            else
            {
                if (Settings.Default.password != "")
                {
                    string[] bwArgs = {"recrypt", Settings.Default.ocryptkey};
                    bwProgress.RunWorkerAsync(bwArgs);
                    recryptpopup = new popupRecrypt(this);
                    recryptpopup.Text = "Removing" + recryptpopup.Text;
                    recryptpopup.ShowDialog(this);

                    mainform.XmlDropNode("ID='password'");
                    Settings.Default.password = "";
                    Settings.Default.cryptkey = Settings.Default.ocryptkey;
                }

                tbGPassword.Enabled = false;
                tbGPassword.Text = "";
                tbGConfirm.Enabled = false;
                tbGConfirm.Text = "";
                bGPassword.Enabled = false;
            }
        }
        private void bPassword_Click(object sender, EventArgs e)
        {
            if (tbGPassword.Text.Trim() == "")
            {
                MessageBox.Show(this, "Password can't be empty", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                tbGPassword.Text = "";
                tbGConfirm.Text = "";
            }
            else if (tbGConfirm.Text != tbGPassword.Text)
            {
                MessageBox.Show(this, "Password confirmation doesn't match", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                tbGConfirm.Text = "";
            }
            else
            {
                if (Settings.Default.password != tbGPassword.Text)
                {
                    Settings.Default.password = tbGPassword.Text;
                    mainform.XmlConfigSet("password", mainform.Encrypt(Settings.Default.password, Settings.Default.pcryptkey));

                    string[] bwArgs = {"recrypt", Settings.Default.password};
                    bwProgress.RunWorkerAsync(bwArgs);
                    recryptpopup = new popupRecrypt(this);
                    recryptpopup.Text = "Applying" + recryptpopup.Text;
                    recryptpopup.ShowDialog(this);

                    Settings.Default.cryptkey = Settings.Default.password;
                }
                bGPassword.Enabled = false;
            }
        }