zoukankan      html  css  js  c++  java
  • Jquery密码强度校验

    function passValidate(){
    var password=$password.val().trim()
    if(password===""){
    $mima.addClass('has-error')
    $password.after('<lable class="help-block">密码不能为空</lable>')
    return false
    }
    //密码为八位及以上并且字母数字特殊字符三项都包括
    var strongRegex = new RegExp("^(?=.{8,})(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*\W).*$", "g");
    //密码为七位及以上并且字母、数字、特殊字符三项中有两项,强度是中等
    var mediumRegex = new RegExp("^(?=.{7,})(((?=.*[A-Z])(?=.*[a-z]))|((?=.*[A-Z])(?=.*[0-9]))|((?=.*[a-z])(?=.*[0-9]))).*$", "g");
    var enoughRegex = new RegExp("(?=.{6,}).*", "g");
    if (false == enoughRegex.test(password)) {
    } else if (strongRegex.test(password)) {
    $password.after('<lable class="help-block"><span class="qiang">密码强度强</span></lable>')
    } else if (mediumRegex.test(password)) {
    $password.after('<lable class="help-block" ><span class="zhong">密码强度中</span></lable>')
    } else {
    $password.after('<lable class="help-block" ><span class="ruo">密码强度弱</span></lable>')
    }

    return true
    }
  • 相关阅读:
    [转]用异或交换两个整数的陷阱
    线索化二叉树
    [转]Socket编程中,阻塞与非阻塞的区别
    两个链表的归并
    [转] std::string and stl 算法
    类图
    leetcode 答案
    about raw socket
    54. Spiral Matrix【数组】
    矩阵乘法问题的实现
  • 原文地址:https://www.cnblogs.com/cuiguangpeng/p/9944817.html
Copyright © 2011-2022 走看看