private void Button_Clicked(object sender, EventArgs e) { var password = ViewModel.MasterPassword; var serviceName = ServicePersistor.GetServiceName(ViewModel.ServiceName); if (!String.IsNullOrEmpty(password) && !String.IsNullOrEmpty(serviceName)) { // Use one set of database vs a new database for a different master password var encryptedMaster = ServicePersistor.GetEncryptedFileName("DFtIETN"); // ServicePersistor.GetEncryptedFileName(password); var requirement = PasswordRequirements.None; SqliteStorage.InitializeStorage(IoCProviders.GetProvider <IKnowStorage>().GetStoragePath(), encryptedMaster); var serviceEntity = ServicePersistor.GetPasswordSettings(serviceName); if (serviceEntity != null) { requirement = (PasswordRequirements)serviceEntity.Requirements; ViewModel.IncludeNumbers = (requirement & PasswordRequirements.NumberRequired) > 0; ViewModel.IncludeSymbols = (requirement & PasswordRequirements.SymbolRequired) > 0; ViewModel.IncludeUppercase = (requirement & PasswordRequirements.UpperCaseRequired) > 0; } else { requirement |= ViewModel.IncludeNumbers ? PasswordRequirements.NumberRequired : PasswordRequirements.NoNumber; requirement |= ViewModel.IncludeSymbols ? PasswordRequirements.SymbolRequired : PasswordRequirements.NoSymbol; requirement |= ViewModel.IncludeUppercase ? PasswordRequirements.UpperCaseRequired : PasswordRequirements.None; } GeneratePassword(password, serviceName, requirement); } }
private void NewPassword_Clicked(object sender, EventArgs e) { var password = ViewModel.MasterPassword; var serviceName = ServicePersistor.GetServiceName(ViewModel.ServiceName); var requirement = PasswordRequirements.None; requirement |= ViewModel.IncludeNumbers ? PasswordRequirements.NumberRequired : PasswordRequirements.NoNumber; requirement |= ViewModel.IncludeSymbols ? PasswordRequirements.SymbolRequired : PasswordRequirements.NoSymbol; requirement |= ViewModel.IncludeUppercase ? PasswordRequirements.UpperCaseRequired : PasswordRequirements.None; GeneratePassword(password, serviceName, requirement); }