Rev 224 | Rev 227 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 224 | Rev 226 | ||
|---|---|---|---|
| Line 69... | Line 69... | ||
| 69 | throw new NegocioException("Senha já existente, tente outra"); |
69 | throw new NegocioException("Senha já existente, tente outra"); |
| 70 | }
|
70 | }
|
| 71 | }
|
71 | }
|
| 72 | 72 | ||
| 73 | @Override |
73 | @Override |
| 74 | public void resetarSenhaUsuario(String login) { |
- | |
| 75 | // BUSCAR EMAIL DO USUÁRIO
|
- | |
| - | 74 | public String resetarSenhaUsuarioRetornandoEmail(String login, String cpf) { |
|
| 76 | String emailUsuario = usuarioRepository.consultarEmailPorLogin(login); |
75 | String emailUsuario = usuarioRepository.consultarEmailPorLogin(login); |
| 77 | if (VerificadorUtil.estaNuloOuVazio(emailUsuario)) { |
76 | if (VerificadorUtil.estaNuloOuVazio(emailUsuario)) { |
| 78 | throw new NegocioException("Usuário não possui email, favor entrar em contato com a administração"); |
77 | throw new NegocioException("Usuário não possui email, favor entrar em contato com a administração"); |
| 79 | }
|
78 | }
|
| 80 | - | ||
| 81 | // GERAR SENHA PROVISÓRIA
|
- | |
| - | 79 | if (usuarioRepository.obterQuantidadeUsuarioComLoginCpfInformados(login, cpf) < 1) { |
|
| - | 80 | throw new NegocioException("Dados não conferem, favor entrar em contato com a administração"); |
|
| - | 81 | }
|
|
| 82 | String senhaProvisoria = new SharedComponente().gerarSenha(8); |
82 | String senhaProvisoria = new SharedComponente().gerarSenha(8); |
| 83 | - | ||
| 84 | // ALTERAR NOVA SENHA DO USUÁRIO
|
- | |
| 85 | usuarioRepository.alterarSenha(login, CriptografiaMD5.criptografaSenha(senhaProvisoria)); |
83 | usuarioRepository.alterarSenha(login, CriptografiaMD5.criptografaSenha(senhaProvisoria)); |
| 86 | - | ||
| 87 | // ENVIAR EMAIL PARA O USUÁRIO
|
- | |
| 88 | new EmailComponente() |
84 | new EmailComponente() |
| 89 | .comEmailDestino(emailUsuario) |
85 | .comEmailDestino(emailUsuario) |
| 90 | .comAssunto("ESPAÇO CASE - REDEFINIÇÃO DE SENHA") |
86 | .comAssunto("ESPAÇO CASE - REDEFINIÇÃO DE SENHA") |
| 91 | .comConteudoHtml("Sua nova senha: " + senhaProvisoria) |
87 | .comConteudoHtml("Sua nova senha: " + senhaProvisoria) |
| 92 | .enviar(); |
88 | .enviar(); |
| - | 89 | return emailUsuario; |
|
| 93 | }
|
90 | }
|
| 94 | 91 | ||
| 95 | /*
|
92 | /*
|
| 96 | @Override
|
93 | @Override
|
| 97 | protected void regrasNegocioCadastrar(Usuario usuario) {
|
94 | protected void regrasNegocioCadastrar(Usuario usuario) {
|