Index: ssts-web/src/main/webapp/personalSetting/modifyPWDByExt.js =================================================================== diff -u -r22276 -r28961 --- ssts-web/src/main/webapp/personalSetting/modifyPWDByExt.js (.../modifyPWDByExt.js) (revision 22276) +++ ssts-web/src/main/webapp/personalSetting/modifyPWDByExt.js (.../modifyPWDByExt.js) (revision 28961) @@ -60,8 +60,9 @@ return false; } //暂时屏蔽验证复杂密码 - if(testPasswordReg(Ext.getCmp('newPassword').getValue())){ - Ext.MessageBox.show({title:'错误提示', msg:'密码必须是数字与字母组合,长度不小于6!',buttons:Ext.Msg.OK,icon:Ext.Msg.ERROR}); + var checkPasswordResult = testPasswordReg(Ext.getCmp('newPassword').getValue()) + if(!checkPasswordResult.success){ + Ext.MessageBox.show({title:'错误提示', msg:checkPasswordResult.msg, buttons:Ext.Msg.OK,icon:Ext.Msg.ERROR}); return false; } if(Ext.getCmp('newPassword').getValue() != Ext.getCmp('confirmNewPassword').getValue()){ Index: ssts-web/src/main/webapp/personalSetting/showModifyPWDWindowByExt.js =================================================================== diff -u -r22276 -r28961 --- ssts-web/src/main/webapp/personalSetting/showModifyPWDWindowByExt.js (.../showModifyPWDWindowByExt.js) (revision 22276) +++ ssts-web/src/main/webapp/personalSetting/showModifyPWDWindowByExt.js (.../showModifyPWDWindowByExt.js) (revision 28961) @@ -62,10 +62,11 @@ return false; } //暂时屏蔽验证复杂密码 - if (testPasswordReg(Ext.getCmp('newPassword').getValue())) { + var checkPasswordResult = testPasswordReg(Ext.getCmp('newPassword').getValue()) + if (!checkPasswordResult.success) { Ext.MessageBox.show({ title : '错误提示', - msg : '密码必须是数字与字母组合,长度不小于6!', + msg : checkPasswordResult.msg, buttons : Ext.Msg.OK, icon : Ext.Msg.ERROR }); Index: ssts-web/src/main/webapp/personalSetting/showModifyPWDWindowByUnmodified.js =================================================================== diff -u -r22276 -r28961 --- ssts-web/src/main/webapp/personalSetting/showModifyPWDWindowByUnmodified.js (.../showModifyPWDWindowByUnmodified.js) (revision 22276) +++ ssts-web/src/main/webapp/personalSetting/showModifyPWDWindowByUnmodified.js (.../showModifyPWDWindowByUnmodified.js) (revision 28961) @@ -58,10 +58,11 @@ }); return false; } - if (testPasswordReg(Ext.getCmp('newPassword').getValue())) { + var checkPasswordResult = testPasswordReg(Ext.getCmp('newPassword').getValue()) + if (!checkPasswordResult.success) { Ext.MessageBox.show({ title : '错误提示', - msg : '密码必须是数字与字母组合,长度不小于6!', + msg : checkPasswordResult.msg, buttons : Ext.Msg.OK, icon : Ext.Msg.ERROR }); Index: ssts-web/src/main/webapp/js/common.js =================================================================== diff -u -r28717 -r28961 --- ssts-web/src/main/webapp/js/common.js (.../common.js) (revision 28717) +++ ssts-web/src/main/webapp/js/common.js (.../common.js) (revision 28961) @@ -2111,21 +2111,32 @@ } /** - * 密码必须是数字与字母组合,长度不小于8,可有特殊字符 + * 检查密码复杂度的要求,根据配置项进行检查。条件包括最小长度、是否需要包含数字、大写字母、小写字母等 * @param pwd - * @return + * @return {success:false, msg:"密码必须包含大写字母和小写字母,长度最小为8位!"} */ function testPasswordReg(pwd) { /*simon:update needBeStrongPwdWhenModifyPwd当修改密码时,密码是否一定为强密码*/ - if (sstsConfig.needBeStrongPwdWhenModifyPwd) { - if (pwd.length < 6 || !/[0-9]+/.test(pwd) || !/[a-zA-Z]+/.test(pwd)) { - return true; + var pwdConfig = sstsConfig.needBeStrongPwdWhenModifyPwd; + + var obj = {"success":false, "msg":"密码必须包含大写字母、小写字母和数字,长度最小为8位!"}; + + if ( !isUndefinedOrNullOrEmpty(pwdConfig)) { + + var minPwdLength = 6; + if (!isUndefinedOrNullOrEmpty(pwdConfig.minPwdLength)){ + minPwdLength = pwdConfig.minPwdLength; + } + + if (pwd.length < minPwdLength || !/[0-9]+/.test(pwd) || !/[a-z]+/.test(pwd) || !/[A-Z]+/.test(pwd)) { + obj.success = false; } else { - return false; + obj.success = true; } } else { - return false; + obj.success = false; } + return obj; } function isfloat(oNum) { Index: ssts-web/src/main/webapp/systemmanage/userFormExt.js =================================================================== diff -u -r28926 -r28961 --- ssts-web/src/main/webapp/systemmanage/userFormExt.js (.../userFormExt.js) (revision 28926) +++ ssts-web/src/main/webapp/systemmanage/userFormExt.js (.../userFormExt.js) (revision 28961) @@ -59,10 +59,6 @@ if(Ext.isEmpty(id)){ var passwdValue = Ext.getCmp('passwd').getValue(); var confirmpwdValue = Ext.getCmp('confirmpwd').getValue(); - /*if(testPasswordReg(passwdValue)){ - alert("密码必须是数字与字母组合,长度不小于8"); - return false; - }*/ if(passwdValue!= confirmpwdValue){ alert("两次输入密码不相同,请重新输入!"); Ext.getCmp('confirmpwd').setValue(""); Index: ssts-web/src/main/webapp/systemmanage/adminModifyPWDByExt.js =================================================================== diff -u -r22262 -r28961 --- ssts-web/src/main/webapp/systemmanage/adminModifyPWDByExt.js (.../adminModifyPWDByExt.js) (revision 22262) +++ ssts-web/src/main/webapp/systemmanage/adminModifyPWDByExt.js (.../adminModifyPWDByExt.js) (revision 28961) @@ -7,17 +7,19 @@ return false; } //暂时屏蔽验证复杂密码 - if(testPasswordReg(newPassword)){ - alert("密码必须是数字与字母组合,长度不小于6"); + var checkPasswordResult = testPasswordReg(newPassword); + if(!checkPasswordResult.success){ + alert(checkPasswordResult.msg); return false; } if (confirmNewPassword == ""){ alert('请输入确认新密码!'); return false; } //暂时屏蔽验证复杂密码 - if(testPasswordReg(newPassword)){ - alert("密码必须是数字与字母组合,长度不小于6"); + var checkPasswordResult = testPasswordReg(newPassword); + if(!checkPasswordResult.success){ + alert(checkPasswordResult.msg); return false; } if (newPassword != confirmNewPassword) {