1const showPassIcon = BASE_URL + "web_assets/frontend/img/show_pass.svg"; 2const hidePassIcon = BASE_URL + "web_assets/frontend/img/hide_pass.svg"; 3$(document).ready(function () { 4 $(".loginForm").on('submit', function (e) { 5 e.preventDefault(); 6 let email = $("#email").val(); 7 let password = $("#uPass").val() 8 if (email === "") { 9 validationError("#email_error", "Email is required"); 10 $("#email").addClass('!ring-red-500'); 11 } else if (password === "") { 12 validationError("#password_error", "Password is required"); 13 } else { 14 let data = { 15 email, 16 password 17 }; 18 $(".validation").empty().prev().find('input').removeClass('!ring-red-500'); 19 $('.loginBtn').prop('disabled', true); 20 with_cloudflare_captcha(false, (Date.now() / 1000), loginForm, 'light', '#cloudflare_container', data); 21 } 22 }); 23 $('.togglePassShow').on('click', function () { 24 const icon = $(this); 25 const input = icon.siblings('input'); 26 const isPassword = input.attr('type') === 'password'; 27 input.attr('type', isPassword ? 'text' : 'password'); 28 icon.attr('src', isPassword ? hidePassIcon : showPassIcon) 29 }); 30 31 $(".forgotForm").on('submit', function (e) { 32 e.preventDefault() 33 const email = $("#forget-email").val(); 34 if (email) { 35 $.ajax({ 36 type: "POST", 37 url: BASE_URL + "emd/forgot-password", 38 data: { email }, 39 beforeSend: () => { 40 $(".forgot-pass-btn").text('Sending...').css('pointer-events', 'none'); 41 }, 42 success: function (response) { 43 if (response.status) { 44 alertBox('info', "Email Sent", response.mess); 45 } else { 46 alertBox('warning', "Error", response.mess); 47 } 48 }, 49 error: (error) => { 50 let response = error.responseJSON; 51 if (error.status === 429) { 52 alertBox('danger', "Too many requests", " Please try again later."); 53 } else { 54 alertBox('danger', "Error", response?.mess || response?.message || "An error occurred. Please try again."); 55 } 56 }, 57 complete: () => { 58 $(".forgot-pass-btn").text('Send Email').css('pointer-events', 'auto'); 59 } 60 }); 61 } 62 }); 63 $(".reset-password-btn").on('click', function (e) { 64 e.preventDefault(); 65 var newPassword = $('#new_password').val(); 66 var confirmPassword = $('#confirm_password').val(); 67 if (!newPassword || !confirmPassword) { 68 alertBox('warning', 'Error', 'Please fill in all fields.'); 69 return; 70 } else if (newPassword.length < 8) { 71 alertBox('warning', 'Password Too Short', 'Password must be at least 8 characters long.'); 72 return; 73 } else if (newPassword.length > 30) { 74 alertBox('warning', 'Password Too Long', 'Password must not exceed 30 characters.'); 75 return; 76 } else if (newPassword !== confirmPassword) { 77 alertBox('warning', 'Passwords Do Not Match', 'New Password and Confirm Password do not match.'); 78 return; 79 } else { 80 $.ajax({ 81 type: "POST", 82 url: BASE_URL + "emd/reset-password/" + token, 83 data: { password: confirmPassword }, 84 beforeSend: () => { $(this).text('Updating...').css('pointer-events', 'none'); }, 85 success: function (response) { 86 if (response.status) { 87 alertBox('info', "Password Update", "Password updated successfully"); 88 setTimeout(() => { window.location = "/login" }, 2000); 89 } else { 90 alertBox('danger', "Error", "Failed to update password. Please try again."); 91 } 92 }, error: function (error) { 93 let response = error.responseJSON; 94 alertBox('danger', "Error", response?.mess || response?.message || "An error occurred. Please try again."); 95 }, complete: () => { $(this).text('Reset password').css('pointer-events', 'auto'); } 96 }); 97 } 98 }); 99 const verify_alert = $('.verify_alert'); 100 if (verify_alert.length && verify_alert.is(':visible')) { 101 setTimeout(() => { 102 verify_alert.fadeOut(300); 103 }, 3000); 104 } 105 // Hide instantly on click 106 verify_alert.on('click', function () { 107 $(this).fadeOut(200); 108 }); 109}); 110const loginForm = (captcha_1, captcha_2, body) => { 111 let data = addDefaultData(body, captcha_1, captcha_2) 112 113 $.ajax({ 114 type: "POST", 115 url: BASE_URL + "emd/login/web", 116 data, 117 success: function (response) { 118 if (response.status) { 119 window.location.href = BASE_URL; 120 } else { 121 validationError("#login_error", response.mess); 122 } 123 }, 124 error: function (error) { 125 const response = error.responseJSON; 126 validationError("#login_error", response?.mess || response?.message || "An error occurred. Please try again."); 127 if (response.verify_require) { 128 window.location.href = BASE_URL + "verify-email?email=" + btoa($('input[name="email"]').val()); 129 } 130 }, complete: () => { 131 $('.loginBtn').prop('disabled', false); 132 } 133 }); 134} 135const validationError = (selector, message) => { 136 let html = `<span id="email_error" 137 class="mt-0 flex pt-1.5 gap-1"> 138 <svg width="16" height="17" viewBox="0 0 16 17" fill="none" 139 xmlns="http://www.w3.org/2000/svg"> 140 <path 141 d="M8 6.36663V8.49996M8 10.6333H8.00533M13.3333 8.49996C13.3333 11.4455 10.9455 13.8333 8 13.8333C5.05448 13.8333 2.66667 11.4455 2.66667 8.49996C2.66667 5.55444 5.05448 3.16663 8 3.16663C10.9455 3.16663 13.3333 5.55444 13.3333 8.49996Z" 142 stroke="#EF4444" stroke-width="1.5" stroke-linecap="round" 143 stroke-linejoin="round" /> 144 </svg> 145 <p class="text-xs font-normal text-[#64748B]">${message}</p> 146 </span>`;
147 $(".validation").empty().prev().find('input').removeClass('!ring-red-500'); 148 $(selector).html(html).prev().find('input').addClass('!ring-red-500'); 149}
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.