/////////////////////////////////////////////////////////////////////////////////////// // Javscript validations for Login, Reset Password and Force Change Password screens. /////////////////////////////////////////////////////////////////////////////////////// //Code commented as part of 71322 - To prevent login page from being displayed inside frame - Start //make sure that it's not framed //if(self != top){ //top.location = self.location; //} //Code commented as part of 71322 - End var loginmsg = "Invalid Login. Please try again or contact the System Administrator."; var confmsg = "The security answer is different from the confirm security answer."; var reqfieldsmsg = "Required field(s) empty."; var pwd_nummsg = "New Password should contain at least one number."; var pwd_alphamsg = "New Password should contain at least one letter."; var acc_nummsg = "New Access Code should contain at least one number."; var acc_alphamsg = "New Access Code should contain at least one letter."; var newpwd_uidmsg = "The new password cannot be the same as the user id."; var newpwd_astmsg = "The new password cannot be the value of ********." var newpwd_confmsg = "The new password is different from the confirm password." var newpwd_unqmsg = "The new password is the same as the current one." var newacc_uidmsg = "The new access code cannot be the same as the user id."; var newacc_astmsg = "The new access code cannot be the value of ********." var newacc_confmsg = "The new access code is different from the confirm access code." var newacc_unqmsg = "The new access code is the same as the current one." var mac_browsermsg = "Internet Explorer for Mac is not supported."; var securityquestion = "Please select a security question."; var validsecurityanswer = "The security answer may not contain asterisks. Please re-enter."; var emailaddress = "The email address may not contain less than 3 characters."; var pwd_allowspace="Space is not allowed in new password."; var submitval = 'false'; var loginurl; var idleTimerID = 0; /////////////////////////////////////////////////////// // This function will be invoked onclick Login button. /////////////////////////////////////////////////////// function ValidateLogin(actionurl,asyncurl){ var formobj = document.inputForm; var ellen = formobj.elements.length; var loginurl; var paramsToSubmit; if(document.inputForm.submitbutton){ document.inputForm.submitbutton.disabled='true'; } returnval = ValidateReqFields(formobj,ellen,'login'); if(returnval == false){ document.inputForm.submitbutton.disabled=''; return false; } if(formobj.organizationid) { var orgidval = formobj.organizationid.value; } var useridval = formobj.userid.value; var pwdval = formobj.password.value; var accesscodeval; if(formobj.accesscode){ accesscodeval = formobj.accesscode.value; } if(submitval=='true'){ return false; } if(document.inputForm.passcode){ document.inputForm.submit(); document.inputForm.submitbutton.disabled='true'; return; } // URL encode the org id, user id and the password to protect against these values containing // special characters such as '&' orgidval = encodeURIComponent(orgidval); useridval = encodeURIComponent(useridval); pwdval = encodeURIComponent(pwdval); if(formobj.organizationid){ loginurl = asyncurl; paramsToSubmit = 'organizationid='+orgidval+'&userid='+useridval+'&password='+pwdval; }else{ loginurl = asyncurl; paramsToSubmit = 'userid='+useridval+'&password='+pwdval; } if(formobj.accesscode){ paramsToSubmit = paramsToSubmit + '&accesscode='+accesscodeval; } paramsToSubmit = paramsToSubmit + '&CSRFTOKEN='+csrfToken; http.open("POST", loginurl, true); http.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); http.onreadystatechange = handleHttpResponse; http.send(paramsToSubmit); } ///////////////////////////////////////////////////////////////////////////////////////////// // This function will be invoked onclick Submit and Cancel buttons on Reset Password screen. ///////////////////////////////////////////////////////////////////////////////////////////// function ValidateResetPwd(cmdval,url){ var formobj = document.inputForm; var ellen = formobj.elements.length; formobj.buttonname.value = cmdval; if(cmdval=='cancel'){ formobj.cancelbutton.disabled='true'; formobj.action = url; formobj.submit(); return false; } if(formobj.securityquestion){ if(formobj.securityquestion.options[formobj.securityquestion.selectedIndex].text=='Select a Question'){ alert(securityquestion); formobj.securityquestion.focus(); return false; } } returnval = ValidateReqFields(formobj,ellen,'resetpwd'); if(returnval == false){ return false; } if(formobj.securityanswer){ newanswer = formobj.securityanswer.value; if(newanswer=='********'){ formobj.securityanswer.value = ''; formobj.confsecurityanswer.value = ''; alert(validsecurityanswer); formobj.securityanswer.focus(); return false; } } if(formobj.confsecurityanswer){ newanswer = formobj.securityanswer.value; confanswer = formobj.confsecurityanswer.value; if(newanswer!=confanswer){ alert(confmsg); formobj.confsecurityanswer.value = ''; formobj.confsecurityanswer.focus(); return false; } } if(formobj.primaryemail){ primaryemail = formobj.primaryemail.value; if(primaryemail.length < 3){ alert(emailaddress); formobj.primaryemail.focus(); return false; } } formobj.submitbutton.disabled = 'true'; formobj.submit(); } //////////////////////////////////////////////////////////////////////////////////////////////////// // This function will be invoked onclick Submit and Cancel buttons on Force Change Password screen. //////////////////////////////////////////////////////////////////////////////////////////////////// function ValidateChangePwd(cmdval,screentype,alphanum,minpwdlen,url,allowwhitespace){ var formobj = document.inputForm; var ellen = formobj.elements.length; formobj.buttonname.value = cmdval; if(cmdval=='cancel'){ formobj.cancelbutton.disabled='true'; formobj.action = url; formobj.submit(); return false; } //CR#49083 if(allowwhitespace=='false'){ pwdvalue=formobj.newpassword.value; if(pwdvalue.indexOf(" ") != -1){ alert(pwd_allowspace); formobj.newpassword.value=''; formobj.confirmpassword.value=''; formobj.newpassword.focus(); return false; } } returnval = ValidateReqFields(formobj,ellen,'changepwd'); if(returnval == false){ return false; } if(alphanum=='true'){ pwdvalue=formobj.newpassword.value; numvalue='1234567890'; alphavalue='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; req_number='true'; req_alpha='true'; for(i=0;i*'; document.getElementById('passcodelyr').innerHTML = htmlstr; //contentBefore('loginpasscode'); //contentAfter('loginpasscode'); document.inputForm.submitbutton.value = customizedConfirmPassCode; passcodeFocus(); document.inputForm.submitbutton.disabled=''; }else{ document.inputForm.submitbutton.disabled=''; document.inputForm.submit(); document.inputForm.submitbutton.disabled='true'; } }else{ clearLoginFields(); disableLogin(false); } }else{ clearLoginFields(); disableLogin(false); } } } function clearLoginFields(){ if(document.inputForm.elements["organizationid"]){ document.inputForm.elements["organizationid"].value=''; } if(document.inputForm.elements["userid"]){ document.inputForm.elements["userid"].value=''; } if(document.inputForm.elements["password"]){ document.inputForm.elements["password"].value=''; } if(document.inputForm.elements["accesscode"]){ document.inputForm.elements["accesscode"].value=''; } document.inputForm.submitbutton.disabled=''; } function passcodeFocus(){ var sFormObj = document.inputForm; var nElLen = sFormObj.elements.length; for(nEl=0;nEl