eaiovnaovbqoebvqoeavibavo function esconder(){ if($(".sidebar").hasClass("activo")){ $(".sidebar").toggleClass("activo"); $(".sidebar").css("left","0"); $(".contenido").css("width","calc(100% - 280px)"); $(".contenido").css("margin-left","280px"); }else{ $(".sidebar").toggleClass("activo"); $(".sidebar").css("left","-280px"); $(".contenido").css("width","100%"); $(".contenido").css("margin-left","0px"); } } function iniciarSesionA(){ var mail = document.getElementById('LgMail').value; var password = document.getElementById('LgPass').value; if(mail.length>0 && password.length>0){ var formData= new FormData(document.getElementById('form-login')); $.ajax({ type: "POST", url: "https://juliojodi.com/CEGSystem/Verificar/Alumno", data: formData, cache: false, contentType: false, processData: false }).done(function(response){ var mensaje =JSON.parse(response); console.log(response); if(mensaje=="NO"){ swal({ title: 'Atención', text: "Usuario o contraseña incorrecta", icon: 'error' }).then(function () { window.location.href='https://juliojodi.com/CEGSystem/Vista/pag_loginAlumno.php'; }); } if(mensaje=="No hay usuarios registrados"){ swal({ title: 'Atención', text: "Usuario o contraseña incorrecta", icon: 'error' }).then(function () { window.location.href='https://juliojodi.com/CEGSystem/Vista/pag_loginAlumno.php'; }); } if(mensaje=="Bienvenido"){ swal({ title: 'Atención', text: mensaje, icon: 'success' }).then(function () { window.location.href='https://juliojodi.com/CEGSystem/Page/dashboardAlumno'; }); } }); } } async function enviarPassword() { // Esperar la respuesta del usuario al cuadro de diálogo const resultado = await swal({ title: 'Escribe algún correo registrado al momendo de la inscripción para enviarte los datos de inicio de sesión', content: { element: "input", attributes: { placeholder: "Ingresa el correo", type: "email", }, }, buttons: { confirm: { text: "Enviar", value: true, visible: true, className: "", closeModal: true }, cancel: { text: "Cancelar", value: null, visible: true, className: "", closeModal: true } } }); // Si el usuario no cancela, enviar la petición AJAX if (resultado) { const correo = resultado; const formData = new FormData(); formData.append('correo', correo); // Esperar la respuesta del servidor const respuesta = await enviarPeticionAJAX("https://juliojodi.com/CEGSystem/EnviarCorreo/usuarioRecuperarAlumno", formData); const datos = JSON.parse(respuesta); // Procesar la respuesta if (datos) { swal({ title: 'Atención', text: 'Se envió los datos, revisa tu correo', icon: 'success' }).then(() => { window.location.href = 'https://juliojodi.com/CEGSystem/Vista/Pag_loginAlumno.php'; }); } else { swal({ title: 'Atención', text: 'Hubo un error, intenta de nuevo, asegurate de escribir bien el correo (no hemos podido encontrar el correo escrito)', icon: 'error' }).then(() => { window.location.href = 'https://juliojodi.com/CEGSystem/Vista/Pag_loginAlumno.php'; }); } } } // Función para realizar la petición AJAX async function enviarPeticionAJAX(url, datos) { try { const res = await $.ajax({ type: "POST", url: url, data: datos, cache: false, contentType: false, processData: false }); return res === '1'; // Convertir el resultado a booleano y retornar } catch (error) { console.error("Error en la petición AJAX:", error); return false; // Retornar falso en caso de error } }