

        $(document).ready(function() {



$('#loginform').submit(function() {


document.getElementById('loadlogin').className = "fa fa-circle-o-notch fa-spin ml5";
            $('#alert-invalid-password').addClass("hide");
                var dados = $("#loginform :input").serialize();
                document.getElementById("btnlogin").disabled = true;
                document.getElementById("btnforgot").disabled = true;
                document.getElementById("user").disabled = true;
                document.getElementById("password").disabled = true;


                $.ajax({
                    type: "POST",
                    url: "lib/login/script_php/login-rest.php",
                    data: dados,
                    dataType: "json",
                    success: function(data, textStatus, jqXHR) {

                        if (data.responseCode == "0") {
                            window.location = window.location.origin;

                        }else if (data.responseCode == "5") {
            			    window.location.pathname = "renew-password";	 
            			}else if (data.responseCode == "4") {
            			    window.location.pathname = "customer/module_register/validacao";	 
            			}else if (data.responseCode == "6") {
            			    window.location.pathname = "2fa";	 
            			}else {

            $('#alert-invalid-password').text(data.responseDescription);
            $('#alert-invalid-password').removeClass('hide');
                document.getElementById("btnlogin").disabled = false;
                document.getElementById("btnforgot").disabled = false;
                document.getElementById("user").disabled = false;
                document.getElementById("password").disabled = false;
document.getElementById('loadlogin').className = "fa fa-angle-right ml5";
                        }
                    },
                    error: function(data, textStatus, jqXHR) {
  
            $('#alert-invalid-password').text("Problemas com seu navegador, atualize as preferências do navegador para permitir cookies.");
            $('#alert-invalid-password').removeClass('hide');

            
                document.getElementById("btnlogin").disabled = false;
                document.getElementById("btnforgot").disabled = false;
                document.getElementById("user").disabled = false;
                document.getElementById("password").disabled = false;
document.getElementById('loadlogin').className = "fa fa-angle-right ml5";
							
                    }

                });

                return false;
            
        });




    });
    
    