internal void LoadFrom(ICredentialBase security)
 {
     this.LoadDomainAndUser(security);
     this.favoritePassword = security.Password;
     this.CheckEncryptedPassword(security);
     this.LoadPassword();
 }
Пример #2
0
        private void UpdateFromDefaultValues(ICredentialBase target)
        {
            Settings settings = Settings.Instance;
            var      guarded  = new GuardedCredential(target, this.PersistenceSecurity);

            if (string.IsNullOrEmpty(guarded.Domain))
            {
                guarded.Domain = settings.DefaultDomain;
            }

            if (string.IsNullOrEmpty(guarded.UserName))
            {
                guarded.UserName = settings.DefaultUsername;
            }

            if (string.IsNullOrEmpty(guarded.Password))
            {
                guarded.Password = settings.DefaultPassword;
            }
        }
        private static void UpdateFromDefaultValues(ICredentialBase target)
        {
            Settings settings = Settings.Instance;

            if (string.IsNullOrEmpty(target.Domain))
                target.Domain = settings.DefaultDomain;

            if (string.IsNullOrEmpty(target.UserName))
                target.UserName = settings.DefaultUsername;

            if (string.IsNullOrEmpty(target.Password))
                target.Password = settings.DefaultPassword;
        }
Пример #4
0
 public IGuardedCredential CreateCredential(ICredentialBase credential)
 {
     return(new GuardedCredential(credential, this.persistence.Security));
 }
Пример #5
0
 internal GuardedCredential(ICredentialBase credential, PersistenceSecurity persistenceSecurity)
 {
     this.credential          = credential;
     this.PersistenceSecurity = persistenceSecurity;
 }
 internal void SavePassword(ICredentialBase security)
 {
     if (this.txtPassword.Text != HIDDEN_PASSWORD)
         security.Password = this.txtPassword.Text;
     else
         security.Password = this.favoritePassword;
 }
 internal void LoadDirectlyFrom(ICredentialBase security)
 {
     this.LoadDomainAndUser(security);
     // here dont affect stored password
     this.txtPassword.Text = security.Password;
 }
 private void LoadDomainAndUser(ICredentialBase security)
 {
     this.cmbDomains.Text = security.Domain;
     this.cmbUsers.Text = security.UserName;
 }
        private void CheckEncryptedPassword(ICredentialBase security)
        {
            if (!string.IsNullOrEmpty(this.favoritePassword) || string.IsNullOrEmpty(security.EncryptedPassword))
                return;

            MessageBox.Show("There was an issue with decrypting your password.\n\nPlease provide a new password and save the favorite.");
            this.txtPassword.Text = string.Empty;
            this.favoritePassword = string.Empty;
            this.txtPassword.Focus();
            security.Password = string.Empty;
        }
 internal void SaveUserAndDomain(ICredentialBase security)
 {
     security.Domain = this.cmbDomains.Text;
     security.UserName = this.cmbUsers.Text;
 }
 internal void SaveTo(ICredentialBase security)
 {
     this.SaveUserAndDomain(security);
     this.SavePassword(security);
 }