1window.addEventListener("DOMContentLoaded", function () { 2 let $login_form = document.querySelector("#loginform"); 3 ///let croad_auth_url = window.location.origin + '/index.php/wp-json/croad-auth'; 4 let croad_auth_url = window.location.origin + '/wp-json/croad-auth'; 5 6 if ($login_form) { 7 console.log("login script loaded"); 8 $login_form.addEventListener("submit", function (e) { 9 e.preventDefault(); 10 11 let login_data = new FormData($login_form); 12 let parsed_data = new URLSearchParams(login_data); 13 14 // fetch("/index.php/wp-json/cr-crm/login", { 15 fetch(croad_auth_url + '/login', { 16 method: "POST", 17 body: parsed_data, 18 }).then((res) => res.json()) 19 .then((json) => { 20 //alert(json); 21 if (json.status != "success") { 22 //return alert(json.message); 23 return alert("You have entered an invalid email address or password. Please try again."); 24 } 25 //return window.location.reload(true); 26 //return (window.location.href = "/dashboard"); 27 return (window.location.href = json.next_url); 28 }).catch((err) => { 29 alert('Undefined response'); 30 console.log(`Error: ${err}`); 31 }); 32 }); 33 } 34 35 let $signin_form = document.querySelector("#signin_form"); 36 37 if ($signin_form) { 38 console.log("signin script loaded"); 39 $signin_form.addEventListener("submit", function (e) { 40 e.preventDefault(); 41 42 let signin_data = new FormData($signin_form); 43 let parsed_data = new URLSearchParams(signin_data); 44 45 fetch(croad_auth_url + '/login', { 46 method: "POST", 47 body: parsed_data, 48 }).then((res) => res.json()) 49 .then((json) => { 50 //alert(json); 51 if (json.status != "success") { 52 //return alert(json.message); 53 return alert("You have entered an invalid email address or password. Please try again."); 54 } 55 //return window.location.reload(true); 56 //return (window.location.href = "/plans"); 57 return (window.location.href = json.next_url); 58 }).catch((err) => { 59 alert('Undefined response'); 60 console.log(`Error: ${err}`); 61 }); 62 }); 63 } 64 65 let $logout_form = document.querySelector("#logoutform"); 66 67 if ($logout_form) { 68 $logout_form.addEventListener("click", function (e) { 69 e.preventDefault(); 70 71 let logout_data = new FormData($logout_form); 72 let parsed_data = new URLSearchParams(logout_data); 73 let redirect_url = $logout_form.querySelector("#redirect_url").value; 74 75 fetch(croad_auth_url + '/logout', { 76 method: "POST", 77 body: parsed_data, 78 }) 79 .then((res) => res.json()) 80 .then((json) => { 81 if (json.status != "success") { 82 return alert(json.message); 83 } 84 85 return (window.location.href = redirect_url); 86 }).catch((err) => { 87 console.log(`Error: ${err}`); 88 }); 89 }); 90 } 91 92});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.