1//basic functions 2var UA = navigator.userAgent.toLowerCase(); 3 4function pwKeypress(e, tb) { 5 if (e.which || e.keyCode) { 6 if ((e.which == 13) || (e.keyCode == 13)){ 7 8 if ((UA.indexOf("msie") > 0) || (UA.indexOf("trident") > 0) || (UA.indexOf("edge") > 0)) { $j('#btnSecureLogin').click(); } 9 10 } else { 11 12 eraseLCookie('CE_un2'); eraseLCookie('CE_id'); eraseLCookie('CE_pw2'); eraseLCookie('CE_pw'); eraseLCookie('CE_c'); eraseLCookie('CE_url'); 13 14 } 15 16 } 17 return false; 18} 19 20 21 22function tbFocus(tb) 23{ 24 var loginClass=(tb.id.indexOf("txtUsername")==-1)?PwDefaultClass:UnDefaultClass; 25 var defaultValue=(tb.id.indexOf("txtUsername")==-1)?PwDefaultText:UnDefaultText; 26 if (UA.indexOf('msie') !=-1) 27 { 28 tb.setAttribute("className",loginClass+" unmasked"); 29 } else { 30 tb.setAttribute("class",loginClass+" unmasked"); 31 } 32 if(defaultValue==tb.value) 33 { 34 tb.value = ""; 35 if (UA.indexOf('webkit')!=-1||UA.indexOf('firefox')!=-1) (tb.id.indexOf("txtUsername")==-1)?tb.type="password":tb.type="text"; 36 } 37 setTimeout(function () { tb.focus(); },200); 38} 39 40 41function tbBlur(tb) 42{ 43 var defaultValue=(tb.id.indexOf("txtUsername")==-1)?PwDefaultText:UnDefaultText; 44 if(tb.value=="")tb.value=defaultValue; 45 tbMask(tb); 46} 47 48 49function tbMask(tb) 50{ 51 var loginClass=(tb.id.indexOf("txtUsername")==-1)?PwDefaultClass:UnDefaultClass; 52 var defaultValue=(tb.id.indexOf("txtUsername")==-1)?PwDefaultText:UnDefaultText; 53 if(tb.value==""||tb.value==defaultValue) 54 { 55 if (UA.indexOf('msie')!=-1) 56 { 57 tb.setAttribute("className",loginClass+" masked"); 58 } else { 59 if(tb.id.indexOf("txtUsername")==-1&&(UA.indexOf('webkit')!=-1||UA.indexOf('firefox')!=-1)) 60 { 61 tb.type="text"; 62 tb.setAttribute("class",loginClass+" masked"); 63 } 64 if(tb.id.indexOf("txtUsername")!=-1)tb.setAttribute("class",loginClass+" masked"); 65 } 66 } 67 else 68 { 69 if (UA.indexOf('msie')!=-1) 70 { 71 tb.setAttribute("className",loginClass+" unmasked"); 72 } else { 73 tb.setAttribute("class",loginClass+" unmasked"); 74 } 75 } 76} 77 78 79var pwId = ""; 80var unId = ""; 81function ieBlur(sender) { 82 sender = $j(sender).attr("id"); 83 var altTbId = ""; 84 if (sender.indexOf("txtUsername") !== -1) { altTbId = "txtIeAltUsername"; unId = sender; }; 85 if (sender.indexOf("txtPassword") !== -1 || sender.indexOf("txtCookiePassword") !== -1) { altTbId = "txtIeAltPassword"; pwId = sender; }; 86 var AltTb = document.getElementById(altTbId); 87 if (!AltTb) return; 88 try { 89 if (document.getElementById(sender).value == "") { 90 document.getElementById(sender).style.display = "none"; 91 if (AltTb) AltTb.style.display = "block"; 92 } else { 93 document.getElementById(sender).style.display = "block"; 94 if (AltTb) AltTb.style.display = "none"; 95 } 96 } catch (e) { 97 if (AltTb) AltTb.style.display = "none"; 98 } 99} 100 101 102function ieFocus(sender) { 103 sender = $j(sender).attr("id"); 104 var altTbId = ""; 105 if (sender.indexOf("AltUsername") !== -1) altTbId = unId; 106 if (sender.indexOf("AltPassword") !== -1) altTbId = pwId; 107 var AltTb = document.getElementById(sender); 108 var Tb = document.getElementById(altTbId); 109 if (Tb) { 110 Tb.setAttribute("className", PwDefaultClass + " unmasked"); 111 Tb.style.display = "block"; 112 Tb.focus(); 113 } 114 if (AltTb) AltTb.style.display = "none"; 115} 116 117function LoadPage() 118{ 119 var WrapDiv = document.getElementById("wrapLogin"+PluginID); 120 if(WrapDiv) 121 { 122 var inputs = WrapDiv.getElementsByTagName("input"); 123 for(var i=0;i<inputs.length;i++) 124 { 125 if(inputs[i].type=="text") 126 { 127 tbMask(inputs[i]); 128 if (UA.indexOf('firefox') == -1 && UA.indexOf('webkit') == -1 && UnDefaultText != "") { 129 ieBlur(inputs[i]); 130 } 131 } 132 } 133 } 134 $j('#defaultnetform').attr('autocomplete', 'off'); 135} 136 137 138$j(document).ready(function () { 139 if (((UA.indexOf("msie") > 0) || (UA.indexOf("trident") > 0) || (UA.indexOf("edge") > 0)) && ($j('#btnSecureLogin').length > 0)) { 140 141 document.forms["defaultnetform"].onsubmit = loginSubmit; 142 } 143 }); 144 145 146function loginSubmit() { 147 if ($j('#' + txtUsernameClientID).val() != '' && $j('#' + txtUsernameClientID).val() != UnDefaultText) { 148 $j('#btnSecureLogin').click(); 149 return false; 150 } 151} 152 153// new secure 154var rKey='';var PathToAsmxL='';var GoToPage='';var Framed='';var PtoP='';var successAction = ""; 155var LoginInProcess = false; 156 157function doLogin(GoToPageL,FramedL,PtoPL) 158{ 159 if (LoginInProcess){return false;}; 160 LoginInProcess=true; 161 GoToPage=GoToPageL;Framed=Framed;PtoP=PtoPL; 162 PathToAsmxL=sitepathL+'/a_master/net/net_advancedlogin/login.asmx'; 163 $j.ajax({ 164 type: "POST", contentType: "application/json; charset=utf-8", 165 url: PathToAsmxL + "/loginStep1?r=" + Math.floor(Math.random() * 1000), 166 data: "{'lstep':1}", 167 dataType: "json", 168 success: function (data) { 169 $j.each(eval('(' + dataFix(data) + ')'), function (key, item) { 170 if (useAltL == '2') { 171 loginAuth(URLDecode(item.key), URLDecode(item.cip)); 172 } else { 173 if (useAltL == '1') { 174 loginStep2Alt(URLDecode(item.key), URLDecode(item.cip)); 175 } else { 176 loginStep2(URLDecode(item.key), URLDecode(item.cip)); 177 } 178 } 179 }); 180 }, 181 error: function (e) { LoginInProcess = false; } 182 });
183 return false; 184} 185 186function loginStep2(key,cip) 187{ 188 var id_e,pw_e,cip_e; 189 var id = $j('#' + txtUsernameClientID).val(); 190 var pw = $j('#' + txtPasswordClientID).val(); 191 var url = ''; 192 193 if (txtUrlInput_ClientID != '') { 194 url = $j('#' + txtUrlInput_ClientID).val(); 195 } 196 197 198 var id_c = getIDCookie(); 199 var pw_c = getPWCookie(); 200 var url_c = getURLCookie(); 201 202 if (id_c != '') { id = id_c } 203 if (pw_c != '') { pw = pw_c } 204 if (url_c != '') { url = url_c } //get 205 206 eraseLCookie('CE_un2'); 207 eraseLCookie('CE_id'); 208 eraseLCookie('CE_pw2'); 209 eraseLCookie('CE_pw'); 210 eraseLCookie('CE_c'); 211 eraseLCookie('CE_url'); 212 213 id_e = $j.rc4EncryptStr(id, key); 214 pw_e = $j.rc4EncryptStr(pw, key); 215 cip_e = $j.rc4EncryptStr(cip, key);// enc 216 217 try { 218 if ($j('#' + ckBxRememberMeClientID).attr('checked')) { 219 createLCookie('CE_id', id_e, 365); 220 createLCookie('CE_pw', pw_e, 365); 221 createLCookie('CE_c', key, 365); 222 createLCookie('CE_url', url, 365); 223 } 224 } catch (e) { 225 } //set 226 227 $j.ajax({ 228 type: "POST", contentType: "application/json; charset=utf-8", 229 url: PathToAsmxL + "/loginStep2?r=" + Math.floor(Math.random() * 1000), 230 data: "{'id': '" + URLEncode(id_e) + "', 'pw': '" + URLEncode(pw_e) + "', 'url': '" + URLEncode(url) + "', 'cip': '" + URLEncode(cip_e) + "'}", 231 dataType: "json", 232 success: function (data) { 233 $j.each(eval('(' + dataFix(data) + ')'), function (key, item) { 234 loginStep3(URLDecode(item.token)); 235 }); 236 }, 237 error: function (e) { 238 LoginInProcess = false; 239 } 240 }); 241 242} 243 244 function loginStep2Alt(key, cip) { 245 var id_e, pw_e, cip_e; 246 var id = $j('#' + txtUsernameClientID).val(); var pw = $j('#' + txtPasswordClientID).val(); 247 var url = ''; if (txtUrlInput_ClientID != '') { url = $j('#' + txtUrlInput_ClientID).val(); } 248 var id_c = getIDCookie(); var pw_c = getPWCookie(); var url_c = getURLCookie(); if (id_c != '') { id = id_c } if (pw_c != '') { pw = pw_c } if (url_c != '') { url = url_c } //get 249 eraseLCookie('CE_un2'); eraseLCookie('CE_id'); eraseLCookie('CE_pw2'); eraseLCookie('CE_pw'); eraseLCookie('CE_c'); eraseLCookie('CE_url'); 250 id_e = $j.rc4EncryptStr(id, key); pw_e = $j.rc4EncryptStr(pw, key); cip_e = $j.rc4EncryptStr(cip, key); // enc 251 try { if ($j('#' + ckBxRememberMeClientID).attr('checked')) { createLCookie('CE_id', id_e, 365); createLCookie('CE_pw', pw_e, 365); createLCookie('CE_c', key, 365); createLCookie('CE_url', url, 365); } } catch (e) { } //set 252 $j.ajax({ 253 type: "POST", contentType: "application/json; charset=utf-8", 254 url: PathToAsmxL + "/loginStep2Alt?r=" + Math.floor(Math.random() * 1000), 255 data: "{'id': '" + URLEncode(id_e) + "', 'pw': '" + URLEncode(pw_e) + "', 'url': '" + URLEncode(url) + "', 'key': '" + URLEncode(key) + "', 'cip': '" + URLEncode(cip_e) + "'}", 256 dataType: "json", 257 success: function (data) { $j.each(eval('(' + dataFix(data) + ')'), function (key, item) { loginStep3(URLDecode(item.token)); }); }, 258 error: function (e) { LoginInProcess = false; } 259 }); 260 261 } 262 263 function loginAuth(key, cip) { 264 var id_e, pw_e, cip_e; 265 var id = $j('#' + txtUsernameClientID).val(); 266 var pw = $j('#' + txtPasswordClientID).val(); 267 var url = ''; 268 269 if (txtUrlInput_ClientID != '') { 270 url = $j('#' + txtUrlInput_ClientID).val(); 271 } 272 273 var id_c = getIDCookie(); 274 var pw_c = getPWCookie(); 275 var url_c = getURLCookie(); 276 277 if (id_c != '') { id = id_c } 278 if (pw_c != '') { pw = pw_c } 279 if (url_c != '') { url = url_c } //get 280 281 eraseLCookie('CE_un2'); 282 eraseLCookie('CE_id'); 283 eraseLCookie('CE_pw2'); 284 eraseLCookie('CE_pw'); 285 eraseLCookie('CE_c'); 286 eraseLCookie('CE_url'); 287 288 id_e = $j.rc4EncryptStr(id, key); 289 pw_e = $j.rc4EncryptStr(pw, key); 290 cip_e = $j.rc4EncryptStr(cip, key); // enc 291 292 try { 293 if ($j('#' + ckBxRememberMeClientID).attr('checked')) { 294 createLCookie('CE_id', id_e, 365); 295 createLCookie('CE_pw', pw_e, 365); 296 createLCookie('CE_c', key, 365); 297 createLCookie('CE_url', url, 365); 298 } 299 } catch (e) { 300 } //set 301 302 $j.ajax({ 303 type: "POST", contentType: "application/json; charset=utf-8", 304 url: PathToAsmxL + "/loginAuthorize?r=" + Math.floor(Math.random() * 1000), 305 data: "{'id': '" + URLEncode(id_e) + "', 'pw': '" + URLEncode(pw_e) + "', 'url': '" + URLEncode(url) + "', 'cip': '" + URLEncode(cip_e) + "'}", 306 dataType: "json", 307 success: function (data) { 308 $j.each(eval('(' + dataFix(data) + ')'), function (key, item) { 309 loginConfirm(item.status, item.message); 310 }); 311 }, 312 error: function (e) { 313 LoginInProcess = false; 314 } 315 }); 316 317 } 318 319 320 321 322 323 function loginConfirm(s,msg) { 324 if (s == "-1") { 325 setTimeout(successAction, 0); 326 $j('.errLogin').hide(); 327 } else { 328 $j('.errLogin').html(msg); 329 $j('.errLogin').show(); 330 } 331 LoginInProcess = false; 332 } 333 334function wsLogin(act) { 335 useAltL = '2'; 336 if (act == "") { 337 successAction = "alert('Login successful. Please modify your successAction on document ready!')"; 338 } else { 339 successAction = act; 340 } 341} 342 343function loginStep3(token){ 344 if ((Framed==0) || (Framed==2) || (Framed==3) || (Framed==4) || (Framed==5)){ 345 if ((PtoP=="0") ||(PtoP==null)) 346 { 347 window.top.location.href = sitepathL + "/default.aspx?login=true&sessionToken=" + URLEncode(token) + "&gotopage=" + URLEncode(GoToPage) + ""; 348 } 349 else 350 { 351 window.top.location.href = sitepathL + "/default.aspx?login=true&PtoP=true&PtoPLoginUID=" + PtoP + "&sessionToken=" + URLEncode(token) + "&gotopage=" + URLEncode(GoToPage) + ""; 352 } 353 } 354 else 355 { 356 if ((PtoP=="0") ||(PtoP==null)) 357 { 358 window.top.location.href = sitepathL + "/default.aspx?login=true&sessionToken=" + URLEncode(token) + "&gotopage=" + URLEncode(GoToPage) + ""; 359 } 360 else 361 { 362 window.top.location.href = sitepathL + "/default.aspx?login=true&PtoP=true&PtoPLoginUID=" + PtoP + "&sessionToken=" + URLEncode(token) + "&gotopage=" + URLEncode(GoToPage) + ""; 363 } 364 } 365 LoginInProcess=false; 366} 367 368var getIDCookie = function(){ 369 var c = readLCookie('CE_un2');if (c==null||c==''){c = declCookie('CE_id')}if (c==null){c=''} 370 return c; 371}; 372var getPWCookie = function(){ 373 var c = readLCookie('CE_pw2');if (c==null||c==''){c = declCookie('CE_pw')}if (c==null){c=''} 374 return c; 375}; 376var getURLCookie = function(){ 377 var c = readLCookie('CE_url');if (c==null){c=''} 378 return c; 379}; 380var declCookie = function (name) { 381 var c = readLCookie(name); var k = readLCookie('CE_c'); 382 try { c = $j.rc4DecryptStr(c, k); } catch (e) { c = null } 383 return c; 384}; 385 386var createLCookie = function (name, value, days) { if (days) { var date = new Date(); date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); var expires = "; expires=" + date.toGMTString(); } else var expires = ""; document.cookie = name + "=" + value + expires + "; path=/"; }; 387var readLCookie = function (name) { var nameEQ = name + "="; var ca = document.cookie.split(';'); for (var i = 0; i < ca.length; i++) { var c = ca[i]; while (c.charAt(0) == ' ') c = c.substring(1, c.length); if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length); } return null; }; 388var eraseLCookie = function (name) { 389 if (ckBxRememberMeClientID != "") { 390 createLCookie(name, "", -1); 391 } 392}; 393 394function URLEncode(val) { 395 try { 396 var SAFECHARS = "0123456789" + // Numeric 397 "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + // Alphabetic 398 "abcdefghijklmnopqrstuvwxyz" + 399 "-_.!~*'()";
399 // RFC2396 Mark characters 400 var HEX = "0123456789ABCDEF"; 401 var plaintext = val; 402 var encoded = ""; 403 for (var i = 0; i < plaintext.length; i++ ) { 404 var ch = plaintext.charAt(i); 405 if (ch == " ") { 406 encoded += "+"; // x-www-urlencoded, rather than %20 407 } else if (SAFECHARS.indexOf(ch) != -1) { 408 encoded += ch; 409 } else { 410 var charCode = ch.charCodeAt(0); 411 if (charCode > 255) { 412 encoded += "+"; 413 } else { 414 encoded += "%"; 415 encoded += HEX.charAt((charCode >> 4) & 0xF); 416 encoded += HEX.charAt(charCode & 0xF); 417 } 418 } 419 } // for 420 } 421 catch(e) 422 { 423 encoded=val; 424 } 425 return encoded; 426}; 427 428function URLDecode(val ) 429{ 430 var HEXCHARS = "0123456789ABCDEFabcdef"; 431 var encoded = val; 432 var plaintext = ""; 433 var i = 0; 434 while (i < encoded.length) { 435 var ch = encoded.charAt(i); 436 if (ch == "+") { 437 plaintext += " "; 438 i++; 439 } else if (ch == "%") { 440 if (i < (encoded.length-2) 441 && HEXCHARS.indexOf(encoded.charAt(i+1)) != -1 442 && HEXCHARS.indexOf(encoded.charAt(i+2)) != -1 ) { 443 plaintext += unescape( encoded.substr(i,3) ); 444 i += 3; 445 } else { 446 plaintext += "%[ERROR]"; 447 i++; 448 } 449 } else { 450 plaintext += ch; 451 i++; 452 } 453 } // while 454 return plaintext; 455}; 456 457//forgot login stuff 458 459 460function forgotUnPWdlg(theSitePath) { 461 showAxisDialog("forgotcreds", { 462 href: theSitePath + "/dialog.aspx?p=.NETForgotLogin", 463 width: 600, 464 height: 500, 465 title: "Find your account", 466 destroyOnClose: false, 467 maximize: false, 468 move: false, 469 resize: false, 470 showCloseX: true, 471 onClose: function (dialogBox) { location.reload(); } 472 }); 473}; 474 475 476 477 478 479 480 481/* JQuery RC4 encryption/decryption 482 * Copyright (c) 2009 by Tony Simek. 483 * released under the terms of the Gnu Public License. 484 * Email: [email protected] 485 */ 486(function($){$.fn.rc4=function(settings){ 487 var defaults={key:null,method:"encrypt",callback:null}; 488 var options=$.extend(defaults,settings); 489 if($.fn.rc4.ctrlrInst==null){$.fn.rc4.ctrlrInst=new $.fn.rc4.ctrlr(options);} 490 return this.each(function(){$.fn.rc4.ctrlrInst.settings=options; 491 $.fn.rc4.ctrlrInst.container=this;$.fn.rc4.ctrlrInst.initialise(this); 492});} 493$.extend({hexEncode:function(data){ 494 var b16D='0123456789abcdef';var b16M=new Array(); 495 for(var i=0;i<256;i++){b16M[i]=b16D.charAt(i>>4)+b16D.charAt(i&15); } 496 var result=new Array();for(var i=0;i<data.length;i++){result[i]=b16M[data.charCodeAt(i)]; } 497 return result.join(''); 498},hexDecode:function(data){var b16D='0123456789abcdef';var b16M=new Array(); 499 for(var i=0;i<256;i++){b16M[b16D.charAt(i>>4)+b16D.charAt(i&15)]=String.fromCharCode(i);} 500 if(!data.match(/^[a-f0-9]*$/i))return false;if(data.length%2)data='0'+data; 501 var result=new Array();var j=0;for(var i=0;i<data.length;i+=2){result[j++]=b16M[data.substr(i,2)];} 502 return result.join(''); 503},rc4Encrypt:function(key,pt){ 504 s=new Array();for (var i=0;i<256;i++){s[i]=i;};var j=0;var x; 505 for (i=0;i<256;i++){j=(j+s[i]+key.charCodeAt(i % key.length)) % 256;x=s[i];s[i]=s[j];s[j]=x;} 506 i=0;j=0;var ct='';for (var y=0;y<pt.length;y++){i=(i+1) % 256;j=(j+s[i]) % 256;x=s[i];s[i]=s[j];s[j]=x; 507 ct+=String.fromCharCode(pt.charCodeAt(y) ^ s[(s[i]+s[j]) % 256]);}return ct; 508},rc4Decrypt:function(key,ct){return $.rc4Encrypt(key,ct); 509},rc4EncryptStr:function(str,key){return $.hexEncode($.rc4Encrypt(key,unescape(encodeURIComponent(str)))); 510},rc4DecryptStr:function(hexStr,key){return decodeURIComponent(escape($.rc4Decrypt(key,$.hexDecode(hexStr))));} 511}); 512$.rc4={};$.fn.rc4.ctrlrInst=null;$.fn.rc4.ctrlr=function(settings){this.settings=settings;};var ctrlr=$.fn.rc4.ctrlr; 513ctrlr.prototype.initialise=function(){ 514 if(this.settings.key){if(this.settings.method){if($.trim(this.settings.method.toUpperCase())=="ENCRYPT"){ 515 this.setObjectValue($.hexEncode($.rc4Encrypt(this.settings.key,this.getObjectValue())))} 516 if($.trim(this.settings.method.toUpperCase())=="DECRYPT"){ 517 this.setObjectValue($.rc4Decrypt(this.settings.key,$.hexDecode(this.getObjectValue())));}}}; 518} 519ctrlr.prototype.getObjectValue=function(){ 520 if($.fn.rc4.ctrlrInst.container.innerHTML){return $.fn.rc4.ctrlrInst.container.innerHTML;} 521 if($.fn.rc4.ctrlrInst.container.value){return $.fn.rc4.ctrlrInst.container.value;}} 522ctrlr.prototype.setObjectValue=function(data){ 523 if($.fn.rc4.ctrlrInst.container.innerHTML){$.fn.rc4.ctrlrInst.container.innerHTML=data;} 524 if($.fn.rc4.ctrlrInst.container.value){$.fn.rc4.ctrlrInst.container.value=data;}} 525})(jQuery);
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.