/*var hasCrossbowAccess = false; var hasPortalAccess = false; var hasCrossSellsAccess = false; var hasProfileViewerAccess = false; var passwordExpired = false; var userAuthenticated = false; var userName = ''; var isInternal = true;*/ function doSSOLogin(){ /*Comment this part out before deploying in any environment. This is for Lloyd's UI tesing*/ userAuthenticated = false; //userName = document.getElementById('username').value; hasCrossbowAccess = false; hasCrossSellsAccess = false; hasPortalAccess = false; hasProfileViewerAccess = false; passwordExpired = false; isInternal = false; //document.loginForm.submit(); //return; //Uncomment the lines below after the UI testing is done and before deployment. var uid=document.getElementById('username').value; var pwd=document.getElementById('password').value; var ssoXML = getSSOXML(uid, pwd); //document.loginForm.submit(); userAuthenticated = false; //alert(ssoXML); if (ssoXML!=null){ // alert('yes!!!!'); userName = getUserName(ssoXML); if(userName!=null){ userAuthenticated = true; //alert('userName='+userName); //var testnodes = ssoXML.getElementsByTagName('accountInfo'); //alert(testnodes.length); hasCrossbowAccess = getGroupAccess(ssoXML,'Crossbow',1); hasCrossSellsAccess = getGroupAccess(ssoXML,'Anne',1); hasProfileViewerAccess = getGroupAccess(ssoXML,'ProfileViewer_Users',1); //Sharada:This is a temporary fix for the Nov30 go live. Need to make the accept terms work. hasPortalAccess = true;//getyeGroupAccess(ssoXML,'portaluser',1); //alert(hasPortalAccess); passwordExpired = getPasswordExpired(ssoXML); isInternal = getIsInternal(ssoXML); //isInternal=false; if(!hasPortalAccess) needterms=true; // 'alert('hasCrossbowAccess='+hasCrossbowAccess+', hasCrossSellsAccess='+hasCrossSellsAccess+', hasProfileViewerAccess='+hasProfileViewerAccess+',isInternal='+isInternal+'hasPortalAccess='+hasPortalAccess); } } /*else alert('no!!!!!!!'); }*/ if(!needterms) fnDoLoginSuccess(userAuthenticated); //fnAcceptTerms(); } function getUserName(xml){ var userName = getNodeValueByIndex(xml, 'username',0); return userName; } function getIsInternal(xml){ var userLocation = getNodeValueByIndex(xml, 'userLocation',0); if(userLocation=='internal') return true; else return false } function getPasswordExpired(xml){ var passwordExpiredTime = getNodeValueByIndex(xml, 'passwordExpiryTime',0); if(passwordExpiredTime!=null && passwordExpiredTime.length>0){ return true; }else return false; } function getGroupAccess(xml, groupname, exactmatch){ var nodes=xml.getElementsByTagName('groupName'); var foundGroup = false; for(var i=0;i0){ //alert(nodes.length); if(nodes[index].childNodes[0] != null){ //alert((nodes[index].childNodes[0].nodeValue)); retval = nodes[index].childNodes[0].nodeValue; } }else{ retval=null; } //alert(retval); return retval; } function getSSOXML(username, password){ var xmlhttp; if (window.XMLHttpRequest){ // code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else{ // code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } var xmlresponse=null; xmlhttp.onreadystatechange=function(){ //alert("xmlhttp.readyState="+xmlhttp.readyState+", xmlhttp.status="+xmlhttp.status); if (xmlhttp.readyState==4 && xmlhttp.status==200){ xmlresponse = xmlhttp.responseXML; //document.location="home_logged.jsp"; //document.write(xmlhttp.responseText); } } xmlhttp.open("POST","sso",false); xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded"); xmlhttp.send("username="+username+"&password="+encodeURIComponent(password)); return xmlresponse; }