private void HashAccountPassword() { BCryptHashGenerator bCryptHashGenerator = new BCryptHashGenerator(); string salt = bCryptHashGenerator.GenerateSalt(); string hashedPassword = bCryptHashGenerator.GenerateHashedString(Coordinator.User.Account.Password, salt); Coordinator.User.Account.Password = hashedPassword; }
private void HashAccountPassword() { BCryptHashGenerator bCryptHashGenerator = new BCryptHashGenerator(); string salt = bCryptHashGenerator.GenerateSalt(); string hashedPassword = bCryptHashGenerator.GenerateHashedString(Practicioner.User.Account.Password, salt); Practicioner.User.Account.Password = hashedPassword; Practicioner.User.Account.Salt = salt; }
private void HashAccountPassword() { BCryptHashGenerator bCryptHashGenerator = new BCryptHashGenerator(); string salt = bCryptHashGenerator.GenerateSalt(); account.Salt = salt; string hashedPassword = bCryptHashGenerator.GenerateHashedString(account.Password, salt); account.Password = hashedPassword; }
private bool IsValidAccountPassword() { BCryptHashGenerator bCryptHashGenerator = new BCryptHashGenerator(); string hashedPassword = bCryptHashGenerator.GenerateHashedString(accountCurrent.Password, accountReceived.Salt); accountCurrent.Password = hashedPassword; _password = hashedPassword; AccountValidator accountValidator = new AccountValidator(accountReceived); ValidationResult dataValidationResult = accountValidator.Validate(accountCurrent); IList <ValidationFailure> validationFailures = dataValidationResult.Errors; UserFeedback userFeedback = new UserFeedback(FormGrid, validationFailures); userFeedback.ShowFeedback(); return(dataValidationResult.IsValid); }
public void SaveAccount() { try { var accountCurrent = _unitOfWork.Accounts.Get(1); BCryptHashGenerator bCryptHashGenerator = new BCryptHashGenerator(); string salt = bCryptHashGenerator.GenerateSalt(); string hashedPassword = bCryptHashGenerator.GenerateHashedString("MMOL78945", salt); accountCurrent.Password = hashedPassword; accountCurrent.Salt = salt; } catch (System.NullReferenceException) { } int expected = 1; int actual = _data.Count; Assert.AreEqual(expected, actual); }