newpassword.js 9.0 KB

1
  1. var __newpassword=function(a){var r=function(f){function p(){var b=document.getElementById("us-new-password-first-textbox").value,c=document.getElementById("us-password-check-rule1"),d=document.getElementById("us-password-check-rule2"),e=document.getElementById("us-password-check-rule3"),h=document.getElementById("us-password-check-rule4"),f=document.getElementById("us-password-check-rule5"),g=!0;a.ESVS.LimitMinNewPWLen<=b.length?c.className="check":(c.className="",g=!1);if(a.bsUtil().isKeyProtected())return g;"NPKI"===a.ESVS.PKI||2===a.ESVS.LimitNewPWPattern?(c=/^(?=.*[a-zA-Z])(?=.*[0-9])(?=.*[^a-zA-Z0-9])/g,c.exec(b)?d.className="check":(d.className="",g=!1)):1===a.ESVS.LimitNewPWPattern&&(c=/^(?=.*[a-zA-Z])(?=.*[0-9])/g,c.exec(b)?d.className="check":(d.className="",g=!1));if("NPKI"===a.ESVS.PKI&&a.ESVS.ChangePWByNPKINewPattern)if(c=/['"\\|]/g,c.exec(b)?(f.className="",g=!1):f.className="check",2<b.length){for(d=0;d<b.length-2;d++)if(b.charAt(d)===b.charAt(d+1)&&b.charAt(d)===b.charAt(d+2)){e.className="";g=!1;break}else e.className="check";for(d=0;d<b.length-2;d++)if(b.charCodeAt(d)===b.charCodeAt(d+1)-1&&b.charCodeAt(d)===b.charCodeAt(d+2)-2){h.className="";g=!1;break}else h.className="check"}else e.className="check",h.className="check";return g}function l(b){var c=document.getElementById("us-new-password-first-textbox"),d=document.getElementById("us-new-password-second-textbox"),e=c.value,h=d.value;e&&4&a.ESVS.Mode&&("touchen"==a.ESVS.SecureKeyboardType&&a.bsUtil().isTouchEnKeyUsable()?(e=a.bsUtil().GetEncryptPwd("us-keyboard-secure-frm","us-new-password-first-textbox"),h=a.bsUtil().GetEncryptPwd("us-keyboard-secure-frm2","us-new-password-second-textbox")):"ahnlab"==a.ESVS.SecureKeyboardType&&a.bsUtil().isAhnlabProtectorUsable()&&(e=a.bsUtil().GetAhnlabEncInputInfo("us-new-password-first-textbox"),h=a.bsUtil().GetAhnlabEncInputInfo("us-new-password-second-textbox")));if(a.bsUtil().isKeyProtected())4&a.ESVS.Mode&&a.nimservice()&&a.nimservice().CheckNewPasswdCombination(e,h,a.ESVS.LimitMinNewPWLen,a.ESVS.LimitMaxNewPWLen,a.ESVS.LimitNewPWPattern,function(b,g){if(0!=b)return a.ERROR.Code=b,a.ERROR.Message=g,a.uiUtil().errMsgBox(g,b),c.value="",d.value="",a.bsUtil().AhnlabClearText("us-new-password-first-textbox"),a.bsUtil().AhnlabClearText("us-new-password-second-textbox"),!1;f.onConfirm(e,h);c.value="";d.value=""});else{if(!e)return a.uiUtil().msgBox(b.IDS_MSGBOX_ERROR_PLEASE_INPUT_NEW_PASSWORD),c.focus(),!1;if(a.ESVS.LimitMaxNewPWLen<e.length)return a.uiUtil().msgBox(a.ESVS.LimitMaxNewPWLen+b.IDS_MSGBOX_ERROR_LONGER_THAN_LIMIT_MAX_LENGTH),c.focus(),!1;if(!p())return a.uiUtil().msgBox(b.IDS_MSGBOX_ERROR_CANT_PASS_RULES),c.focus(),!1;if(e!=h)return a.uiUtil().msgBox(b.IDS_MSGBOX_ERROR_PLEASE_RETRY_TO_INPUT_CORRECTLY),c.focus(),!1;f.onConfirm(e,h);c.value="";d.value=""}return!0}var k=function(){var b=window.XMLHttpRequest?new window.XMLHttpRequest:new ActiveXObject("MSXML2.XMLHTTP.3.0");b.open("GET",a.ESVS.SRCPath+"unisignweb/rsrc/layout/newpassword.html?version="+a.ver,!1);b.send(null);return b.responseText},m=function(){var b=window.XMLHttpRequest?new window.XMLHttpRequest:new ActiveXObject("MSXML2.XMLHTTP.3.0");b.open("GET",a.ESVS.SRCPath+"unisignweb/rsrc/lang/"+a.ESVS.Language+"/newpassword_"+a.ESVS.Language+".js?version="+a.ver,!1);b.send(null);return b.responseText},n=a.ESVS.TabIndex;return function(){var b=a.CustomEval(k),c=a.CustomEval(m,!0);a.ESVS.TargetObj.innerHTML=b();b=document.getElementById("us-new-password-lbl-title");b.appendChild(document.createTextNode(c.IDS_NEW_PASSWORD));b.setAttribute("tabindex",n,0);document.getElementById("us-new-password-cls-btn-img").setAttribute("src",a.ESVS.SRCPath+"unisignweb/rsrc/img/x-btn.png",0);document.getElementById("us-new-password-lock-img").setAttribute("src",a.ESVS.SRCPath+"unisignweb/rsrc/img/password-lock-img.png",0);document.getElementById("us-new-password-notice-text").innerHTML=f&&f.args&&f.args.renew?c.IDS_RENEW_NEW_PASSWORD_NOTICE+"<br>"+c.IDS_RENEW_NEW_PASSWORD_GUIDE:c.IDS_NEW_PASSWORD_NOTICE+"<br>("+a.ESVS.LimitMinNewPWLen+c.IDS_NEW_PASSWORD_LIMIT+")";document.getElementById("us-new-password-first-lbl").appendChild(document.createTextNode(c.IDS_NEW_PASSWORD_FIRST+" :"));event.getModifierState?(a.uiUtil().addCapsLockEvent("us-new-password-first-textbox","us-new-password-err-msg-capslock","",null),a.uiUtil().addCapsLockEvent("us-new-password-second-textbox","us-new-password-err-msg-capslock","",null),document.getElementById("us-new-password-err-msg-capslock-text").appendChild(document.createTextNode(c.IDS_MSGBOX_CAPSLOCK_ON))):a.uiUtil().addCapsLockEvent("us-new-password-first-textbox","us-new-password-err-msg-capslock",c.IDS_MSGBOX_CAPSLOCK_ON,null);var d=document.getElementById("us-new-password-first-textbox");d.setAttribute("tabindex",n+1,0);d.setAttribute("title",c.IDS_NEW_PASSWORD_FIRST,0);d.onkeyup=function(a){event.getModifierState&&(event.getModifierState("CapsLock")?(document.getElementById("us-new-password-err-msg-capslock").style.top=d.offsetTop+0+30+"px",document.getElementById("us-new-password-err-msg-capslock").style.display="block"):document.getElementById("us-new-password-err-msg-capslock").style.display="none");p()};d.onfocus=function(a){"block"==document.getElementById("us-new-password-err-msg-capslock").style.display&&(document.getElementById("us-new-password-err-msg-capslock").style.top=d.offsetTop+0+30+"px")};document.getElementById("us-new-password-second-lbl").appendChild(document.createTextNode(c.IDS_NEW_PASSWORD_SECOND+" :"));var e=document.getElementById("us-new-password-second-textbox");e.setAttribute("tabindex",n+2,0);e.setAttribute("title",c.IDS_NEW_PASSWORD_SECOND,0);e.onkeydown=function(a){if(a=a?a:event)a=a||window.event,13==(a.which||a.keyCode)&&document.getElementById("us-new-password-confirm-btn").click()};e.onkeyup=function(a){a.getModifierState&&(a.getModifierState("CapsLock")?(document.getElementById("us-new-password-err-msg-capslock").style.top=e.offsetTop+0+30+"px",document.getElementById("us-new-password-err-msg-capslock").style.display="block"):document.getElementById("us-new-password-err-msg-capslock").style.display="none")};e.onfocus=function(a){"block"==document.getElementById("us-new-password-err-msg-capslock").style.display&&(document.getElementById("us-new-password-err-msg-capslock").style.top=e.offsetTop+0+30+"px")};document.getElementById("us-password-check-rule1").appendChild(document.createTextNode(a.ESVS.LimitMinNewPWLen+""+c.IDS_PASSWORD_RULE1));if("NPKI"===a.ESVS.PKI){b=document.getElementById("us-password-check-rule2");b.appendChild(document.createTextNode(c.IDS_PASSWORD_RULE2_ALL));var h=document.getElementById("us-password-check-rule3");h.appendChild(document.createTextNode(c.IDS_PASSWORD_RULE3));var q=document.getElementById("us-password-check-rule4");q.appendChild(document.createTextNode(c.IDS_PASSWORD_RULE4));var g=document.getElementById("us-password-check-rule5");g.appendChild(document.createTextNode(c.IDS_PASSWORD_RULE5));a.bsUtil().isKeyProtected()&&(b.className="disable",h.className="disable",q.className="disable",g.className="disable")}else b=document.getElementById("us-password-check-rule2"),1===a.ESVS.LimitNewPWPattern?b.appendChild(document.createTextNode(c.IDS_PASSWORD_RULE2_ENGNUM)):2===a.ESVS.LimitNewPWPattern&&b.appendChild(document.createTextNode(c.IDS_PASSWORD_RULE2_ALL)),a.bsUtil().isKeyProtected()&&(b.className="disable");document.getElementById("us-new-password-warning-text").appendChild(document.createTextNode(c.IDS_NEW_PASSWORD_WARNING));b=document.getElementById("us-new-password-confirm-btn");b.setAttribute("value",c.IDS_CONFIRM,0);b.setAttribute("title",c.IDS_CONFIRM+c.IDS_BUTTON,0);b.setAttribute("tabindex",n+3,0);b.onclick=function(){l(c)};b=document.getElementById("us-new-password-cancel-btn");b.setAttribute("value",c.IDS_CANCEL,0);b.setAttribute("title",c.IDS_CANCEL+c.IDS_BUTTON,0);b.setAttribute("tabindex",n+4,0);b.onclick=function(){f.onCancel()};b=document.getElementById("us-new-password-cls-img-btn");b.setAttribute("title",c.IDS_NEW_PASSWORD_CLOSE,0);b.setAttribute("tabindex",n+5,0);b.onclick=function(){f.onCancel()};return document.getElementById("us-div-new-password")}()};return function(f){var p=a.uiLayerLevel,l=a.uiUtil().getOverlay(p),k=r({type:f.type,args:f.args,onConfirm:f.onConfirm,onCancel:f.onCancel});k.style.zIndex=p+1;a.ESVS.TargetObj.insertBefore(l,a.ESVS.TargetObj.firstChild);var m=window.onresize;return{show:function(){a.ActiveUI=this;draggable(k,document.getElementById("us-div-new-password-title"));l.style.display="block";a.uiUtil().offsetResize(k);window.onresize=function(){a.uiUtil().offsetResize(k);m&&m()};a.uiLayerLevel+=10;a.ESVS.TabIndex+=30;a.bsUtil().ahnlabInit();setTimeout(function(){var f=k.getElementsByTagName("p");if(0<f.length)for(var b=0;b<f.length;b++)"us-new-password-lbl-title"==f[b].id&&f[b].focus();a.bsUtil().SetSecurityStatus("us-new-password-first-textbox");a.bsUtil().SetSecurityStatus("us-new-password-second-textbox");a.bsUtil().SetReScan()},10)},hide:function(){l.style.display="none";k.style.display="none"},dispose:function(){window.onresize=function(){m&&m()};k.parentNode.removeChild(k);l.parentNode.removeChild(l);a.uiLayerLevel-=10;a.ESVS.TabIndex-=30}}}};