function functionEnter(evt) { var Tecla = evt.keyCode ? evt.keyCode : evt.charCode ? evt.charCode : evt.which ? evt.which : void 0; if(Tecla == 13) valida_login(); else return false; } function mostraTipoLogin(){ if(document.getElementById('selectPerfil').value == 0){ document.getElementById('embarcador_cnpj').style.visible=false; } else { } } function validaCnpj() { var esqueciSenhaId = $('#esqueciSenhaId').val(1); if(document.getElementById('selectPerfil').value == 0) { if (document.getElementById("embarcador_cnpj").value == "") { alert("O campo Código de Acesso está vazio"); setTimeout(function() { document.getElementById("embarcador_cnpj").focus(); }, 10); $("#captchaId").show(); $("#validaCaptcha").val(true); return false; } else if (document.getElementById("usuario_login").value == ""){ alert("O campo login está vazio"); $("#captchaId").show(); $("#validaCaptcha").val(true); return false; } else if (document.getElementById('embarcador_cnpj').value.length == 14) { if (!check_cgc(document.getElementById('embarcador_cnpj').value)) { } } if (confirm("Sua senha será alterada e enviada por e-mail. Confirmar o processamento?")){ document.forms[0].cnpjEmbarcador.value = document.getElementById('embarcador_cnpj').value; document.forms[0].usrLogin.value = document.getElementById('usuario_login').value; $("#validaCaptcha").val(true); document.forms[0].submit(); } //mostraCaptchaPopup(); } else if(document.getElementById('selectPerfil').value == 1) { document.getElementById("transportador_cgcpf").value = document.getElementById("embarcador_cnpj").value; if (document.getElementById("transportador_cgcpf").value == ""){ alert("O campo CPF/CNPJ está vazio"); // document.getElementById("embarcador_cnpj").focus(); setTimeout(function() { document.getElementById("embarcador_cnpj").focus(); }, 10); $("#captchaId").show(); $("#validaCaptcha").val(true); return false; } else if (document.getElementById("usuario_login").value == ""){ alert("O campo login está vazio"); setTimeout(function() { document.getElementById("usuario_login").focus(); }, 10); $("#captchaId").show(); $("#validaCaptcha").val(true); return false; } else if (document.getElementById("usuario_login").value != "ADMINISTRADOR"){ alert("Solicite ao administrador, a alteração de sua senha."); setTimeout(function() { document.getElementById("usuario_login").focus(); }, 10); $("#captchaId").show(); $("#validaCaptcha").val(true); return false; } else if (document.getElementById('transportador_cgcpf').value.length == 11) { if (!checaCpf1(document.getElementById('transportador_cgcpf').value)) { alert("CPF informado é inválido."); setTimeout(function() { document.getElementById("embarcador_cnpj").focus(); }, 10); $("#captchaId").show(); $("#validaCaptcha").val(true); return false; } } else if (document.getElementById('transportador_cgcpf').value.length == 14) { if (!check_cgc(document.getElementById('transportador_cgcpf').value)) { alert("CNPJ informado é inválido."); setTimeout(function() { document.getElementById("embarcador_cnpj").focus(); }, 10); $("#captchaId").show(); $("#validaCaptcha").val(true); return false; } /* else { alert("O campo Login está inválido"); setTimeout(function() { document.getElementById("embarcador_cnpj").focus(); }, 10); return false; } */ } if (confirm("Sua senha será alterada e enviada por e-mail. Confirmar o processamento?")){ document.forms[0].cnpjTransportador.value = document.getElementById('embarcador_cnpj').value; document.forms[0].submit(); } } } function valida_login() { document.getElementById('btnLogin').onclick= ''; var siteToken = document.getElementById("mtcaptcha-verifiedtoken-1").value; var validaCaptcha = $("#validaCaptcha").val(); if(document.getElementById("embarcador_cnpj").value == 0){ alert("O campo Código de Acesso está vazio"); document.getElementById('btnLogin').onclick= valida_login; setTimeout(function() { document.getElementById("embarcador_cnpj").focus(); }, 10); $("#captchaId").show(); $("#validaCaptcha").val(true); return false; } else if(document.getElementById("usuario_login").value == ""){ alert("O campo Login está vazio"); setTimeout(function() { document.getElementById("usuario_login").focus(); }, 10); document.getElementById('btnLogin').onclick= valida_login; $("#captchaId").show(); $("#validaCaptcha").val(true); return false; } else if(document.getElementById("embarcador_senha").value == ""){ alert("O campo Senha está vazio"); setTimeout(function() { document.getElementById("embarcador_senha").focus(); }, 10); document.getElementById('btnLogin').onclick= valida_login; $("#captchaId").show(); $("#validaCaptcha").val(true); return false; }else if(siteToken == "" && validaCaptcha == "true"){ alert("O campo Captcha não é válido!"); setTimeout(function() { document.getElementById("embarcador_cnpj").focus(); }, 10); document.getElementById('btnLogin').onclick= valida_login; $("#captchaId").show(); $("#validaCaptcha").val(true); return false; } document.getElementById("siteTokenCaptcha").value = siteToken; document.getElementById("embToken").value = document.forms[0].hdnToken.value; DWREngine.setAsync(false); if(document.getElementById('selectPerfil').value == 0) { if (document.getElementById("embarcador_cnpj").value == ""){ alert("O campo Código de Acesso está vazio"); document.getElementById('btnLogin').onclick= valida_login; setTimeout(function() { document.getElementById("embarcador_cnpj").focus(); }, 10); $("#captchaId").show(); $("#validaCaptcha").val(true); return false; } ValidacoesAJAX.validaCNPJ(document.getElementById("embarcador_cnpj").value, cnpjExiste); } else { if(document.getElementById("embarcador_cnpj").value.length <= 11 ) { document.getElementById("embarcador_cnpj").value = completar(11,document.getElementById("embarcador_cnpj").value,'0'); } else if (document.getElementById("embarcador_cnpj").value.length < 14){ document.getElementById("embarcador_cnpj").value = completar(14,document.getElementById("embarcador_cnpj").value,'0'); } if (document.getElementById("embarcador_cnpj").value == ""){ alert("O campo CPF/CNPJ está vazio"); document.getElementById('btnLogin').onclick= valida_login; $("#captchaId").show(); $("#validaCaptcha").val(true); return false; } ValidacoesAJAX.validaCPFCNPJTransp(document.getElementById("embarcador_cnpj").value, cnpjExiste); } } function cnpjExiste(retorno) { if(!retorno) { alert("Login informado não consta em nosso cadastro. \nClique em \"Cadastre-se\" para usufruir dos benefícios do vale-pedágio."); setTimeout(function() { document.getElementById("embarcador_cnpj").focus(); }, 10); document.getElementById('btnLogin').onclick= valida_login; $("#captchaId").show(); $("#validaCaptcha").val(true); return; } if(document.getElementById("embarcador_senha").value == ""){ alert("O campo senha é obrigatório"); setTimeout(function() { document.getElementById("embarcador_senha").focus(); }, 10); document.getElementById('btnLogin').onclick= valida_login; $("#captchaId").show(); $("#validaCaptcha").val(true); return; } if (document.getElementById("embarcador_senha").value.length < 8) { alert("O campo senha deve conter no mínimo 8 caracteres"); setTimeout(function() { document.getElementById("embarcador_senha").focus(); }, 10); document.getElementById('btnLogin').onclick= valida_login; $("#captchaId").show(); $("#validaCaptcha").val(true); return; } if(document.getElementById("selectPerfil").value == 0) { document.forms[2].submit(); } else if(document.getElementById('selectPerfil').value == 1) { document.getElementById("transportador_cgcpf").value = document.getElementById("embarcador_cnpj").value; document.getElementById("transportador_login").value = document.forms[2].usuario_login.value; document.getElementById("transportador_senha").value = document.getElementById("embarcador_senha").value; document.getElementById("transportador_token").value = document.getElementById("embToken").value document.forms[1].submit(); } } function mostraCaptchaPopup(){ blockLoading('html', { message: $('#captchaId'), css: { border: 'none', padding: '15px', backgroundColor: '#000', '-webkit-border-radius': '10px', '-moz-border-radius': '10px', //opacity: .5, color: '#fff' } }); } function mt_verifiedcb(state) { //console.log("mt_verifiedcb(state)"); // console.log("state => "+JSON.stringify(state)); //zeraContadorTentativaPlacaCaptcha(); var esqueciSenhaId = $('#esqueciSenhaId').val(); if(esqueciSenhaId){ desabilitaCaptcha(); /* if (confirm("Sua senha será alterada e enviada por e-mail. Confirmar o processamento?")){ document.forms[0].cnpjEmbarcador.value = document.getElementById('embarcador_cnpj').value; document.forms[0].usrLogin.value = document.getElementById('usuario_login').value; $("#validaCaptcha").val(true); document.forms[0].submit(); } */ } } function desabilitaCaptcha(){ unblockPage(); }