public JsonResult AutenticaPessoa(String vstrCPF, String vstrSenha) { //Retorno object lobjException = null; bool lblnRetorno = false; //Objetos Exception lexcMensagem = null; // Auxiliar try { if (!String.IsNullOrEmpty(vstrCPF) && !String.IsNullOrWhiteSpace(vstrCPF) && !String.IsNullOrEmpty(vstrSenha) && !String.IsNullOrWhiteSpace(vstrSenha)) { PessoaFisica pessoa = this.PessoaFisicaRepository.Obter(vstrCPF); if (pessoa != default(PessoaFisica)) { String senhaBase64 = Utils.Base64Encode(vstrSenha); if (pessoa.Senha.Equals(senhaBase64)) { UserAuthentication.LoginPessoaFisica(vstrCPF, pessoa.Codigo, pessoa.Nome); lblnRetorno = true; } } } } catch (Exception ex) { if (lexcMensagem == null) { lexcMensagem = ex; } } finally { if (lexcMensagem != null) { lobjException = mobjGlobal.ConverterParaJson(mobjGlobal.CriarException(lexcMensagem, lexcMensagem.Message)); lexcMensagem = null; } } return(Json( new { Exception = lobjException, Retorno = lblnRetorno }, "json" )); }