Ejemplo n.º 1
0
 /// <summary>
 /// Method for updating the contents of a saved set of credentials
 /// </summary>
 /// <param name="user">The user whose list contains the credentials in question</param>
 /// <param name="creds">The credentials to be updated</param>
 /// <param name="path">The directory path to where the app can find the PassOne data files</param>
 public void UpdateCredentials(PassOneUser user, PassOneCredentials creds)
 {
     try
     {
         GetService().Edit(creds);
     }
     catch (CryptographicException)
     {
         throw new EncryptionException();
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Method to create a new credentials entry and save it to the data.bin file
        /// </summary>
        /// <param name="passOneUser">The user these credentials are saved on</param>
        /// <param name="creds">Credentials to be created</param>
        /// <param name="path">The location of the data.bin file</param>
        /// <returns>the Id of the credentials just created</returns>
        public int CreateCredentials(PassOneUser passOneUser, PassOneCredentials creds)
        {
            if (GetCredentialsList(passOneUser).ContainsKey(creds.Website))
                throw new TitleAlreadyExistsException();

            var credsSvc = GetService(Services.EntityCredentialsImplementation);
            creds.Id = credsSvc.GetNextIdValue();
            creds.UserId = passOneUser.Id;
            credsSvc.Create(creds);
            return creds.Id;
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Method for deleting a credentials entry
 /// </summary>
 /// <param name="creds">The credentials to be deleted</param>
 /// <param name="passOneUser">The user whose list contains the credentials in question</param>
 /// <param name="path">The directory path to where the app can find the PassOne data files</param>
 public void DeleteCredentials(PassOneCredentials creds, PassOneUser passOneUser)
 {
     try
     {
         //creds.Encrypt(user.Encryption);
         GetService(Services.EntityCredentialsImplementation).Delete(creds);
     }
     catch (CryptographicException)
     {
         throw new EncryptionException();
     }
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Method for deleting a credentials entry
 /// </summary>
 /// <param name="creds">The credentials to be deleted</param>
 /// <param name="user">The user whose list contains the credentials in question</param>
 /// <param name="path">The directory path to where the app can find the PassOne data files</param>
 public void DeleteCredentials(PassOneCredentials creds, PassOneUser user)
 {
     try
     {
         creds.Encrypt(new Encryption(user.K, user.V));
         GetService().Delete(creds);
     }
     catch (CryptographicException)
     {
         throw new EncryptionException();
     }
 }
Ejemplo n.º 5
0
 protected void CredentialsListBox_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (PasswordValue.Visible)
     {
         PasswordValue.Visible = false;
         ShowPasswordButton.Text = "Show Password";
     }
     _passOneUser = (PassOneUser)Session["User"];
     var id = _userManager.GetCredentialsList(_passOneUser)[CredentialsListBox.SelectedItem.Value];
     _selectedCredentials = _credentialsManager.FindCredentials(_passOneUser, id);
     WebsiteValue.Text = _selectedCredentials.Website;
     UrlValue.Text = _selectedCredentials.Url;
     UsernameValue.Text = _selectedCredentials.Username;
     EmailValue.Text = _selectedCredentials.EmailAddress;
     PasswordValue.Text = _selectedCredentials.Password;
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Method to set the current details object with new Credential's information
 /// </summary>
 /// <param name="creds">The credentials to be placed into details</param>
 public void SetDetails(PassOneCredentials creds)
 {
     Details = new Details(OnDetailsChanged);
        Details.Title = creds.Website;
        Details.Url = creds.Url;
        Details.Username = creds.Username;
        Details.Password = creds.Password;
        Details.Email = creds.EmailAddress;
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Method for updating the contents of a saved set of credentials
 /// </summary>
 /// <param name="passOneUser">The user whose list contains the credentials in question</param>
 /// <param name="creds">The credentials to be updated</param>
 /// <param name="path">The directory path to where the app can find the PassOne data files</param>
 public void UpdateCredentials(PassOneUser passOneUser, PassOneCredentials creds)
 {
     var list = GetCredentialsList(passOneUser);
     if (list.ContainsKey(creds.Website) && FindCredentials(passOneUser, (list[creds.Website])).Id != creds.Id)
         throw new TitleAlreadyExistsException();
     try
     {
         GetService(Services.EntityCredentialsImplementation).Edit(creds);
     }
     catch (CryptographicException)
     {
         throw new EncryptionException();
     }
 }
Ejemplo n.º 8
0
 protected bool Equals(PassOneCredentials other)
 {
     return Id == other.Id && string.Equals(Website, other.Website) && string.Equals(Url, other.Url) &&
            string.Equals(Username, other.Username) && string.Equals(Password, other.Password) &&
            string.Equals(EmailAddress, other.EmailAddress) && EncryptedEquals(EncryptedEmail, other.EncryptedEmail) &&
            EncryptedEquals(EncryptedWebsite, other.EncryptedWebsite) && EncryptedEquals(EncryptedUrl, other.EncryptedUrl) &&
            EncryptedEquals(EncryptedUsername, other.EncryptedUsername) &&
            EncryptedEquals(EncryptedPassword, other.EncryptedPassword);
 }
Ejemplo n.º 9
0
 public int CreateCredentials(PassOneCredentials creds)
 {
     var credsSvc = GetService(Services.CredentialsData) as IPassOneDataSvc;
     credsSvc.Create(creds);
     return creds.Id;
 }
Ejemplo n.º 10
0
 protected void Page_Load(object sender, EventArgs e)
 {
     creds = (PassOneCredentials)Session["Credentials"];
     //NewValueTextBox.Text = GetEditValue();
 }