给注册用户填写和修改密码增加“密码强度”的方法_动易Cms教程

编辑Tag赚U币
教程Tag:暂无Tag,欢迎添加,赚取U币!


大家知道,动易后台治理员修改密码时内置了一个“密码强度”的指示条。有的朋友想把这个应用于前台新用户注册当中。下面以动易海蓝模板为例介绍一下修改方法:

1、给新用户注册加入“密码强度”:在后台打开“用户治理”>>>“会员模板页治理”>>>“会员注册页模板(注册表单)”,找到以下代码

<tr class=left_tdbgall>
<td><B>密码(至少6位):</B><BR>
请输入密码,区分大小写。请尽量设得复杂一些,以防被人暴力猜解。</td>
<td><Input type=password maxLength=12 size=30 name=Password>
</td>
</tr>
<tr class=left_tdbgall>

用下面代码替换:

<tr class=left_tdbgall>
<td><B>密码(至少6位):</B><BR>请输入密码,区分大小写。请尽量设得复杂一些,以防被人暴力猜解。</td>
<td>
<Input onblur=javascript:EvalPwdStrength(document.forms[0],this.value); onkeyup=javascript:EvalPwdStrength(document.forms[0],this.value); onmouseout=javascript:EvalPwdStrength(document.forms[0],this.value); type=password maxLength=12 size=30 name=Password> </td>
</tr>
<tr class=left_tdbgall>
<td><B>密码强度:</B></td>
<td>
<script language='JavaScript' src='../Admin/PwdStrength.js'></script>
<script language='JavaScript'>
<!--
window.onerror = ignoreError;
function ignoreError(){return true;}
function EvalPwdStrength(oF,sP){
PadPasswd(oF,sP.length*2);
if(ClientSideStrongPassword(sP,gSimilarityMap,gDictionary)){DispPwdStrength(3,'cssStrong');}
else if(ClientSideMediumPassword(sP,gSimilarityMap,gDictionary)){DispPwdStrength(2,'cssMedium');}
else if(ClientSideWeakPassword(sP,gSimilarityMap,gDictionary)){DispPwdStrength(1,'cssWeak');}
else{DispPwdStrength(0,'cssPWD');}
}
function PadPasswd(oF,lPwd){
if(typeof oF.PwdPad=='object'){var sPad='IfYouAreReadingThisYouHaveTooMuchFreeTime';var lPad=sPad.length-lPwd;oF.PwdPad.value=sPad.substr(0,(lPad<0)?0:lPad);}
}
function DispPwdStrength(iN,sHL){
if(iN>3){ iN=3;}for(var i=0;i<4;i ){ var sHCR='cssPWD';if(i<=iN){ sHCR=sHL;}if(i>0){ GEId('idSM' i).className=sHCR;}GEId('idSMT' i).style.display=((i==iN)?'inline':'none');}
}
function GEId(sID){return document.getElementById(sID);}
//-->
</script>
<STYLE>
input{FONT-FAMILY:宋体;FONT-SIZE: 9pt;}
.cssPWD{background-color:#EBEBEB;border-right:solid 1px #BEBEBE;border-bottom:solid 1px #BEBEBE;}

查看更多 动易Cms教程  动易Cms模板

共4页上一页1234下一页
来源:模板无忧//所属分类:动易Cms教程/更新时间:2006-09-18
相关动易Cms教程