public string ObterBodyParaEnvioEmail(ConvocadoViewModel convocacao) { var context = new ApplicationDbContext(); var userManager = new UserManager <ApplicationUser>(new UserStore <ApplicationUser>(context)); var dadosCandidato = userManager.FindByEmail(convocacao.Email); var dadosConvocacao = _convocacaoService.GetOne(a => a.ProcessoId.Equals(convocacao.ProcessoId) && a.ConvocadoId.Equals(convocacao.ConvocadoId)); var dadosProcesso = _processoAppService.GetById(convocacao.ProcessoId); var contentEmail = _sysConfig.GetHelpFile("EmailDeConvocacao"); var body = GetTagContent(contentEmail, "body"); if (body == string.Empty) { return(string.Empty); } var senhaCandidato = _passwordGenerator.GetPassword(); userManager.RemovePassword(dadosCandidato.Id); userManager.AddPassword(dadosCandidato.Id, senhaCandidato); body = body.Replace("{DATA}", dadosConvocacao.DataEntregaDocumentos.ToString()); body = body.Replace("{HORA}", dadosConvocacao.HorarioEntregaDocumento); body = body.Replace("{ENDERECO}", dadosConvocacao.EnderecoEntregaDocumento); body = body.Replace("{NOMECONVOCACAO}", dadosProcesso.Nome); body = body.Replace("{USUARIO}", convocacao.Nome); body = body.Replace("{SENHA}", senhaCandidato); return(body); }
public string GeneratePassword() { return(_passwordGenerator.GetPassword()); }
static void GetPass(IPasswordGenerator _passwordGenerator) { Console.Write("Password length (default 8)?: "); int count; try { count = Convert.ToInt32(Console.ReadLine()); _passwordGenerator.SetLength(count); } catch { _passwordGenerator.SetLength(8); } Console.WriteLine(""); Console.Write("Use numbers (default yes)?: "); string useNumber = Console.ReadLine(); if (useNumber == "no") { _passwordGenerator.SetNumber(false); } else { _passwordGenerator.SetNumber(true); } Console.WriteLine(""); Console.Write("Use lower char (default yes)?: "); string useLower = Console.ReadLine(); if (useLower == "no") { _passwordGenerator.SetLower(false); } else { _passwordGenerator.SetLower(true); } Console.WriteLine(""); Console.Write("Use upper char (default yes)?: "); string useUpper = Console.ReadLine(); if (useUpper == "no") { _passwordGenerator.SetUpper(false); } else { _passwordGenerator.SetUpper(true); } Console.WriteLine(""); Console.Write("Use special symbols (default yes)?: "); string useSpecialSymbols = Console.ReadLine(); if (useSpecialSymbols == "no") { _passwordGenerator.SetSpecialSymbols(false); } else { _passwordGenerator.SetSpecialSymbols(true); } Console.WriteLine(""); Console.WriteLine(""); Console.WriteLine("------------------------------------"); Console.WriteLine(_passwordGenerator.GetPassword()); for (int i = 0; i < 1000; i++) { Console.WriteLine(_passwordGenerator.GetPassword()); } Console.WriteLine("------------------------------------"); }
public void PasswordGeneratorReturnsNonemptyString() { var result = generator.GetPassword(criteria); Assert.IsTrue(result != null); }