javascript 工具方法(长期更新)

时间:2015-05-12 13:26:55   收藏:0   阅读:129
     //密码强度判断,低级:不到八位;中级:八位以上;高级:八位以上并加入了特殊符号。
        function pwdStrength(pwd) {
            var pwdLevel;
            if ((pwd && pwd.length < 8) || !isPwd(pwd)) {
                pwdLevel = 1;
            } else if ((pwd && pwd.length == 8)
                || /[`~!@#$%^&*()\-_+=\\|{}‘:;\",\[\].<>\/?~!@#¥%……&*()——+|{}【】‘;:”“’。,、?]/.test(pwd)) {
                pwdLevel = 2;
            } else {
                pwdLevel = 3;
            }
            console.log(‘pwdLevel=‘ + pwdLevel);
            return pwdLevel;
        }

 

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!