1var IPADDRESS = ""; 2var LOCATION = ""; 3function checkPasswordStrength(field, divPStrength) { 4 var number = /([0-9])/; 5 var alphabets = /([a-zA-Z])/; 6 var special_characters = /([~,!,@,#,$,%,^,&,*,-,_,+,=,?,>,<])/; 7 8 if ($('#' + field).val().length >= 8 && $('#' + field).val().match(number) && $('#' + field).val().match(alphabets) && $('#' + field).val().match(special_characters)) { 9 $('#' + divPStrength).removeClass(); 10 $('#' + divPStrength).addClass('strong-password'); 11 $('#' + divPStrength).html("Strong"); 12 } 13 else { 14 $('#' + divPStrength).removeClass(); 15 $('#' + divPStrength).addClass('weak-password'); 16 $('#' + divPStrength).html("Weak"); 17 } 18} 19 20$(document).ready(function () { 21 try { 22 var ipData = GetBrowserClientIpAddress(); 23 var location = GetClientLocation(); 24 IPADDRESS = ''; 25 LOCATION = ''; 26 ipData.then(function (data) { 27 if (data != null) { 28 if (CheckIfDataIsNotNullOrEmptyOrUndefined(data.ipaddress)) 29 IPADDRESS = data.ipaddress 30 } 31 }); 32 location.then(function (data) { 33 if (data != null) { 34 if (CheckIfDataIsNotNullOrEmptyOrUndefined(data.latitude)) 35 LOCATION = JSON.stringify({ latitude: data.latitude, longitude: data.longitude }); 36 } 37 }) 38 } catch (error) { } 39 40 $('#ancChangeUser').hide(); 41 $('#ancVBCLookup').hide(); 42 document.cookie = "calDialogShown=0"; 43 document.cookie = "alertDialogShown=0"; 44 45 if (document.cookie.indexOf("keepmesignedin=off") > -1) { 46 $('#chkKeepMeSignedIn').attr('checked', false); 47 } else { 48 $('#chkKeepMeSignedIn').attr('checked', true); 49 } 50 51 $("#lblloginattempts").text(0); 52 53 hideloader(); 54 if (window.location.href.toLowerCase().indexOf("login") > 0) { 55 $("#txtemail,#txtpwd,#txtOTP").keypress(function (e) { 56 if (e.which == 13) 57 $('#btnlogin').click(); 58 }); 59 } else { 60 $("#txtemail").keypress(function (e) { 61 if (e.which == 13) 62 $('#btnSubmit').click(); 63 }); 64 $("#txtOTP").keypress(function (e) { 65 if (e.which == 13) 66 $('#btnVerifyOtp').click(); 67 }); 68 $("#txtPassword,#txtConfirmPassword").keypress(function (e) { 69 if (e.which == 13) 70 $('#btnChangePassword').click(); 71 }); 72 } 73 $("#txtpwd, #txtConfirmPassword, #txtPassword").keypress(function (e) { 74 if (e.which == 32) { 75 e.preventDefault(); 76 alert("Spaces are not allowed in Password."); 77 } 78 }); 79 $('#btnlogin').click(function () { 80 verifylogin(); 81 }); 82 $('#btnSubmit').click(function () { 83 forgotPassword(true); 84 }); 85 $('#btnVerifyOtp').click(function () { 86 validateOTP(); 87 }); 88 $('#btnChangePassword').click(function () { 89 changePassword(); 90 }); 91 $("#chkKeepMeSignedIn").click(function () { 92 var keepmesignedin = $('input[name="chkKeepMeSignedIn"]:checked').serialize(); 93 if (keepmesignedin == "") 94 keepmesignedin = "off"; 95 else 96 keepmesignedin = "on"; 97 if (keepmesignedin == "on") 98 alert("Please make sure this is your trusted device"); 99 }); 100 function changePassword() { 101 var email = $('#' + txtemail).val(); 102 var password = $('#txtPassword').val(); 103 if (password.indexOf("\\") > -1 || password.indexOf("\"") > -1 || 104 password.indexOf("\'") > -1 || password.indexOf("<") > -1 || password.indexOf(">") > -1) { 105 alert("Special characters \\\"\'<> not allowed"); 106 return false; 107 } 108 showloader(); 109 var confirmPassword = $('#txtConfirmPassword').val(); 110 if (!$("form")[0].reportValidity()) { 111 hideloader(); 112 return false; 113 } 114 if (confirmPassword != password) { 115 hideloader(); 116 alert('Password and Confirm Password are not matching'); 117 return false; 118 } 119 if ($("#divPStrength").text() != "Strong") { 120 hideloader(); 121 alert('Password should match the rules'); 122 return false; 123 } 124 var date = moment().format("MM/DD/YYYY"); 125 $.ajax({
126 type: "POST", 127 url: "Pages/AgentChangePassword.aspx/ChangePasswordforEmail", 128 data: "{'email' : '" + email + "','password' : '" + password + "','date' : '" + date + "','ipAddress' : '" + IPADDRESS + "','location' : '" + LOCATION + "'}", 129 contentType: "application/json; charset=utf-8", 130 dataType: "json", 131 success: function (data) { 132 var obj = data.d; 133 if (obj.Status == "PASSWORDNOTMATCH") { 134 hideloader(); 135 alert("The passwords don't match. Please try again."); 136 } else if (obj.Status != "INVALID") { 137 ShowSuccessAlert("Your password is successfully changed."); 138 if (document.cookie.toString().indexOf("cookieconsent") < 0) 139 document.cookie = "cookieconsent=true"; 140 if (obj.Status == "EXPIRYALERT") 141 alert(obj.Message); 142 if (obj.Status == "SUBSCRIPTIONEXPIRED" || obj.Status == "NOSUBSCRIPTION" || obj.Status == "PARTIAL") { 143 alert(obj.Message); 144 if (window.location.href.toLowerCase().indexOf("login") < 0) 145 window.location.href = '../Web/Login'; 146 hideloader(); 147 return; 148 } 149 if (obj != null && obj.ProducerType != null && obj.ProducerType.indexOf("Campaign Admin") > -1) 150 window.location.href = '../Web/AgencyHome'; 151 else 152 window.location.href = '../Web/Home'; 153 } else { 154 hideloader(); 155 alert('Something went wrong. Please try again'); 156 } 157 }, 158 error: function (data) { 159 hideloader(); 160 alert('Something went wrong. Please try again') 161 } 162 }); 163 } 164 165 function forgotPassword(re = true) { 166 if ($("#txtemail").val() == '') { 167 $('#alertblankcred').show('fade'); 168 setTimeout(function () { 169 $('#alertblankcred').hide('fade'); 170 }, 2000); 171 return false; 172 } 173 showloader(); 174 var email = $('#txtemail').val(); 175 $.ajax({
176 type: "POST", 177 url: "Pages/AgentForgotPassword.aspx/ForgotPasswordEmail", 178 data: "{'email' : '" + email + "','attempt' : '" + re + "'}", 179 contentType: "application/json; charset=utf-8", 180 dataType: "json", 181 async: true, 182 success: function (data) { 183 var obj = data.d; 184 hideloader(); 185 if (obj == "true") { 186 ShowSuccessAlert("Verification code is sent to your registered email and mobile"); 187 if (re == true) 188 window.location.href = 'ChangePassword'; 189 //hideloader(); 190 } 191 else if (obj == "false") { 192 $('#alertinvalidcred').show('fade'); 193 $("#txtpwd").val(''); 194 setTimeout(function () { 195 $('#alertinvalidcred').hide('fade'); 196 }, 2000); 197 return false; 198 } 199 else { 200 alert(obj); 201 return false; 202 } 203 }, 204 error: function (data) { 205 hideloader(); 206 alert('Something went wrong. Please try again') 207 } 208 }); 209 } 210 $(".pass").hide(); 211 function validateOTP() { 212 showloader(); 213 var email = $('#' + txtemail).val(); 214 var otp = $('#txtOTP').val(); 215 $.ajax({
216 type: "POST", 217 url: "Pages/AgentChangePassword.aspx/ValidateOTP", 218 data: "{'email' : '" + email + "','otp' : '" + otp + "'}", 219 contentType: "application/json; charset=utf-8", 220 dataType: "json", 221 success: function (data) { 222 var obj = data.d; 223 if (obj == true) { 224 $(".pass").show(); 225 $("#divOTP").hide(); 226 $("#txtPassword").prop("required", true); 227 $("#txtPassword").show(); 228 $("#txtPassword").val(""); 229 $("#txtConfirmPassword").prop("required", true); 230 $("#txtConfirmPassword").show(); 231 $("#divpwdnote").show(); 232 hideloader(); 233 $("#divVerifyOtp").hide(); 234 } 235 else { 236 alert("Either verification code does not match or timed out. Please try again"); 237 hideloader(); 238 return false; 239 } 240 }, 241 error: function (data) { 242 hideloader(); 243 alert('Something went wrong. Please try again') 244 } 245 }); 246 } 247 function verifylogin() { 248 if (!$("form")[0].reportValidity()) 249 return false; 250 showloader(); 251 var email = $('#txtemail').val(); 252 var password = $('#txtpwd').val(); 253 var date = moment().format("DD MMM YYYY"); 254 var keepmesignedin = $('input[name="chkKeepMeSignedIn"]:checked').serialize(); 255 if (keepmesignedin == "") 256 keepmesignedin = "off"; 257 else 258 keepmesignedin = "on"; 259 var otp = $('#txtOTP').val(); 260 document.cookie = "keepmesignedin=" + keepmesignedin; 261 $.ajax({
262 type: "POST", 263 url: "Pages/Login.aspx/ValidateLogin", 264 data: "{'email' : '" + email + "','password' : '" + password + "','date' : '" + date + "','keepmesignedin' : '" + keepmesignedin + "','otp':'" + otp + "','ipAddress':'" + IPADDRESS + "','location':'" + LOCATION + "'}", 265 contentType: "application/json; charset=utf-8", 266 dataType: "json", 267 success: function (data) { 268 var obj = data.d; 269 if (obj.Status == "INVALIDUSER") { 270 alert(obj.Message); 271 $('#txtemail').val(''); 272 $('#txtpwd').val(''); 273 $('#txtemail').focus(); 274 hideloader(); 275 return; 276 } 277 if (obj.Status == "INVALIDOTP") { 278 alert(obj.Message); 279 $('#txtOTP').val(""); 280 $('#txtOTP').focus(); 281 hideloader(); 282 return; 283 } 284 if (obj.Status == "DOWNTIME") { 285 window.location.href = '../Web/maintenance'; 286 return; 287 } 288 if (obj.Status == "ACCOUNTLOCKED") { 289 alert("For security reasons, we sent a verification code to your email and mobile."); 290 $("#lblloginattempts").parent().parent().show(); 291 forgotPassword(false); 292 $("#txtOTP").attr("required", "required"); 293 $("#divOTP").show(); 294 //$("#txtpwd").val(''); 295 $('#txtemail').attr("readonly", "readonly"); 296 $("#lblloginattempts").text("0"); 297 $("#lblloginattempts").parent().parent().show(); 298 hideloader(); 299 return; 300 } 301 if (obj.Status != "INVALID") { 302 if (document.cookie.toString().indexOf("cookieconsent") < 0) 303 document.cookie = "cookieconsent=true"; 304 if (obj.Status == "EXPIRYALERT") 305 alert(obj.Message); 306 if (obj.Status == "SUBSCRIPTIONEXPIRED" || 307 obj.Status == "NOSUBSCRIPTION" || obj.Status == "PARTIAL") { 308 alert(obj.Message); 309 hideloader(); 310 return; 311 } 312 var suffix = ""; 313 var urlvars = getUrlVars(); 314 if (urlvars.length > 0) { 315 if (urlvars["id"] != null) { 316 suffix = "?id=" + urlvars["id"]; 317 } 318 } 319 if (obj != null && obj.ProducerType != null && obj.ProducerType.indexOf("Campaign Admin") > -1) 320 window.location.href = '../Web/AgencyHome' + suffix; 321 else 322 window.location.href = '../Web/Home' + suffix; 323 } 324 else { 325 $("#lblloginattempts").parent().parent().show(); 326 $("#lblloginattempts").text(parseInt($("#lblloginattempts").text()) + 1); 327 if ($("#lblloginattempts").text() == "5") { 328 alert("You have exceeded the 5 login retry limits. Please enter the verification code to login again.") 329 forgotPassword(false); 330 $("#txtOTP").attr("required", "required"); 331 $("#divOTP").show(); 332 $("#txtpwd").val(''); 333 $('#txtemail').attr("readonly", "readonly"); 334 $("#lblloginattempts").text("0"); 335 $("#lblloginattempts").parent().parent().hide(); 336 } else { 337 $('#alertinvalidcred').show('fade'); 338 $("#txtpwd").val(''); 339 setTimeout(function () {
340 $('#alertinvalidcred').hide('fade'); 341 }, 2000); 342 } 343 hideloader(); 344 return false; 345 } 346 hideloader(); 347 }, 348 error: function (data) { 349 hideloader(); 350 alert('Something went wrong. Please try again') 351 } 352 }); 353 } 354 355 $('#linkinvalidcredClose').click(function () { 356 $('#alertinvalidcred').hide('fade'); 357 }); 358});
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.