Esempio n. 1
0
        private void ShowPCAFormFromEntry(object sender, EventArgs e)
        {
            m_pcaForm = new PCADialog();
            m_pweForm.UpdateEntryStrings(true, true, true);
            PCAInitData        pcadata = new PCAInitData(m_pweForm.EntryRef);
            ExpiryControlGroup ecg     = (ExpiryControlGroup)Tools.GetField("m_cgExpiry", m_pweForm);

            pcadata.Strings = m_pweForm.EntryStrings;
            if (ecg != null)
            {
                pcadata.Expires   = ecg.Checked;
                pcadata.Expiry    = ecg.Value;
                pcadata.SetExpiry = (pcadata.Expires != m_pweForm.EntryRef.Expires) || (pcadata.Expiry != m_pweForm.EntryRef.ExpiryTime);
            }
            pcadata.URL2 = pcadata.Strings.ReadSafe(Config.PCAURLField);
            DerefStrings(pcadata, m_pweForm.EntryRef);
            m_pcaForm.Init(pcadata, ProfilesOpening);
            if (m_pcaForm.ShowDialog(m_pweForm) == DialogResult.OK)
            {
                m_pweForm.EntryStrings.Set(PwDefs.PasswordField, m_pcaForm.NewPassword);
                if (ecg != null)
                {
                    ecg.Checked = m_pcaForm.EntryExpiry.Checked;
                    if (ecg.Checked)
                    {
                        ecg.Value = m_pcaForm.EntryExpiry.Value.ToUniversalTime();
                    }
                }
                if (string.IsNullOrEmpty(m_pcaForm.Sequence))
                {
                    m_pweForm.EntryStrings.Remove(Config.PCASequence);
                }
                else
                {
                    m_pweForm.EntryStrings.Set(Config.PCASequence, new ProtectedString(false, m_pcaForm.Sequence));
                }
                if (string.IsNullOrEmpty(m_pcaForm.URL2))
                {
                    m_pweForm.EntryStrings.Remove(Config.PCAURLField);
                }
                else
                {
                    m_pweForm.EntryStrings.Set(Config.PCAURLField, new ProtectedString(false, m_pcaForm.URL2));
                }
                m_pweForm.UpdateEntryStrings(false, true, true);
            }
            m_pcaForm.CleanupEx();
            m_pcaForm = null;
        }
Esempio n. 2
0
        private void OnShowPCAForm(object sender, EventArgs e)
        {
            if (!SaveOldPassword())
            {
                return;
            }
            m_pcaForm = new PCADialog();
            PCAInitData pcadata = new PCAInitData(SelectedEntry);

            DerefStrings(pcadata, SelectedEntry);
            m_pcaForm.Init(pcadata, ProfilesOpening);
            if (m_pcaForm.ShowDialog(m_host.MainWindow) == DialogResult.OK)
            {
                SelectedEntry.CreateBackup(Program.MainForm.ActiveDatabase);
                SelectedEntry.Strings.Set(PwDefs.PasswordField, m_pcaForm.NewPassword);
                SelectedEntry.Expires = m_pcaForm.EntryExpiry.Checked;
                if (SelectedEntry.Expires)
                {
                    SelectedEntry.ExpiryTime = m_pcaForm.EntryExpiry.Value.ToUniversalTime();
                }
                if (string.IsNullOrEmpty(m_pcaForm.Sequence))
                {
                    SelectedEntry.Strings.Remove(Config.PCASequence);
                }
                else
                {
                    SelectedEntry.Strings.Set(Config.PCASequence, new ProtectedString(false, m_pcaForm.Sequence));
                }
                if (string.IsNullOrEmpty(m_pcaForm.URL2))
                {
                    SelectedEntry.Strings.Remove(Config.PCAURLField);
                }
                else
                {
                    SelectedEntry.Strings.Set(Config.PCAURLField, new ProtectedString(false, m_pcaForm.URL2));
                }
                SelectedEntry.Touch(true);
                Tools.RefreshEntriesList(true);
            }
            m_pcaForm.CleanupEx();
            m_pcaForm = null;
        }