1$(document).ready(function () { 2 3 page_click(); 4 captcha(); 5 6}); 7 8//function captcha() { 9// $('#btnRefreshCaptcha').on('click', function (e) { 10// e.preventDefault(); 11// $('#imgLoginCaptcha').removeAttr('src'); 12// $('#imgLoginCaptcha').removeAttr('value'); 13// $('#imgLoginCaptcha').attr('src', '@Url.Content("~/")Captcha/GetCaptchaImage?' + new Date().getTime()); 14// $('#imgLoginCaptcha').attr('value', ''); 15// }); 16//} 17function captcha() { 18 $('#btnRefreshCaptcha').on('click', function (e) { 19 e.preventDefault(); 20 // Clear the current captcha image 21 $('#imgLoginCaptcha').removeAttr('src'); 22 $('#imgLoginCaptcha').removeAttr('value'); 23 24 // Set the new captcha image with a unique timestamp to prevent caching 25 $('#imgLoginCaptcha').attr('src', '/Captcha/GetCaptchaImage?' + new Date().getTime()); 26 $('#imgLoginCaptcha').attr('value', ''); 27 }); 28} 29function page_click() { 30 $('#btnLogin').on('click', function (e) { 31 e.preventDefault(); 32 var frmLogin = $('#frmLogin'); 33 var frmLoginParsley = frmLogin.parsley(); 34 frmLoginParsley.validate(); 35 if (!frmLogin.parsley().isValid()) { 36 return false; 37 } 38 var btn = $(this); 39 btn.text('Processing...'); 40 btn.addClass('disabled'); 41 42 var txtpassword = $('#txtPassword').val(); 43 44 var key = CryptoJS.enc.Utf8.parse('8080808080808080'); 45 var iv = CryptoJS.enc.Utf8.parse('8080808080808080'); 46 47 var encryptedpassword = CryptoJS.AES.encrypt(CryptoJS.enc.Utf8.parse(txtpassword), key, 48 { 49 keySize: 128 / 8, 50 iv: iv, 51 mode: CryptoJS.mode.CBC, 52 padding: CryptoJS.pad.Pkcs7 53 }); 54 55 $('#txtPassword').val(encryptedpassword); 56 57 $.ajax({
58 method: 'POST', 59 url: $('#hdfBaseUrl').val() + 'Login/CheckLogin', 60 data: frmLogin.serialize() + '&' + 'CaptchaStr=' + $('#txtCaptcha').val() 61 62 }).done(function (data) { 63 debugger 64 /* if (typeof data !== 'undefined' && data.flagCaptcha?.toString().toLowerCase() === 'true') {*/ 65 console.log("Login Response:", data['flagCaptcha']); // Debug 66 if (data['flagCaptcha'].toString().toLowerCase() == 'true') { 67 if (data['flagValidID'].toString().toLowerCase() == 'true') { 68 69 if (data['flagLogin'].toString().toLowerCase() == 'true') { 70 71 btn.text('Redirecting...'); 72 if (data['flagPasswordChanged'].toString().toLowerCase() == 'true') { 73 74 if (data['flagSubmitted'].toString().toLowerCase() == 'true') { 75 76 //window.location.href = $('#hdfBaseUrl').val() + "Declaration/AllPreview"; 77 window.location.href = $('#hdfBaseUrl').val() + "home"; 78 } 79 else { 80 if (data['flagClose'].toString().toLowerCase() == 'true') { 81 window.location.href = $('#hdfBaseUrl').val() + "Closed"; 82 } 83 else { 84 if (data['POST_ID'].toString() == "9") { 85 window.location.href = $('#hdfBaseUrl').val() + "PersonalDetails"; 86 } 87 else { 88 window.location.href = $('#hdfBaseUrl').val() + "PersonalDetails/IndexPersonal"; 89 } 90 } 91 } 92 } else { 93 window.location.href = $('#hdfBaseUrl').val() + "ChangePassword"; 94 } 95 } else { 96 debugger 97 98 btn.text('Login'); 99 btn.removeClass('disabled'); 100 swal('', 'Invalid login attempted.', 'error'); 101 $('#btnRefreshCaptcha').trigger('click'); 102 $('#txtCaptcha').val(''); 103 debugger 104 } 105 } else { 106 btn.text('Login'); 107 btn.removeClass('disabled'); 108 swal('', 'Invalid Candidate id entered.', 'error'); 109 $('#btnRefreshCaptcha').trigger('click'); 110 $('#txtCaptcha').val(''); 111 } 112 } 113 114 else { 115 btn.text('Login'); 116 btn.removeClass('disabled'); 117 swal('', 'Invalid captcha entered.', 'error'); 118 $('#btnRefreshCaptcha').trigger('click'); 119 $('#txtCaptcha').val(''); 120 } 121 /*}*/ 122 //else { 123 // btn.text('Login'); 124 // btn.removeClass('disabled'); 125 // swal('', 'Access denied.', 'error'); 126 // $('#btnRefreshCaptcha').trigger('click'); 127 // $('#txtCaptcha').val(''); 128 //} 129 }).fail(function () { 130 btn.text('Login'); 131 btn.removeClass('disabled'); 132 swal('', 'Somthing went wrong. Please try again.', 'error'); 133 $('#btnRefreshCaptcha').trigger('click'); 134 $('#txtCaptcha').val(''); 135 }); 136 }); 137} 138
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.