// Copyright 2000-2007, Newsfutures, Inc. All Rights Reserved. // Confidential and Proprietary Information of Newsfutures, Inc. // %Z%%M%, %I%, %G% function setJSL(login) { setCookie("ptsJSL", escape(login.toLowerCase())); } // this is the method used when login in from a login or registration form. It adds a '?' in front to // make it tentative when checking with psl function setJSLFromFld(fldName) { setJSL('?' + document.getElementById(fldName).value); } // when submitting logout request, clear ptsJSL function clearJSL() { deleteCookie("ptsJSL"); } // in all pages call checkPSL($user.login). The login passed must always be the same as the loginUA, otherwise // the browser is redirected to the special page: // /error/switched.html?cmd=UserMgr.report&what=switch&jsl=&psl=<$user.login> // which records the problem and redirects to /index.html. function checkPSL(psl) { // get value of ptsJSL cookie or "" if not set var jsl = getCookie('ptsJSL'); // if psl and jsl are the same, all is well if(psl == jsl) return; // if jsl starts with '?' this is a tentative login or registration, // remove the leading '?' and try again if(jsl.substr(0,1) == '?') { jsl = jsl.substr(1); if(psl == jsl) { // update the jsl cookie to be without the leading '?' (i.e. this is no longer tentative.) setCookie('ptsJSL', jsl, 100000); return; } else if(psl == '') { // there is still a mismatch, but since psl is empty, it's just a failed login or registrations deleteCookie('ptsJSL'); return; } } // if we get here, we have a problem, clear everything and go back to the index page // logout the user deleteCookie("ptsJSL"); deleteCookie("ptsLogin"); // redirect to the error page and record the problem if(true) { window.location = "/iehm/error/switched.html" + "?cmd=UserMgr.report" + "&what=userSwitched" + "&jsl=" + encodeURIComponent(jsl) + "&psl=" + encodeURIComponent(psl); } else { alert("SWITCHED: jsl=" + jsl + " psl=" + psl); } }