export default {

  /**
     * 校验密码的强度
     * @param {*} password 
     */
  handlerPasswordStrength: function(locale,value){
    if(value == null || value.length < 8){
      if(locale == 'en-US'){
        return ('The password length cannot be less than 8!');
      }else{
        return ('密码长度不能小于8！');
      }
    }
    let number = 0; // 数字出现的次数
    let smallLetter = 0; // 小写字母出现的次数
    let bigLetter = 0; // 大写字母出现的次数
    let symbol = 0 ; // 特殊符号出现的次数

    for(let index = 0; index < value.length; index ++){
      let c = value.charCodeAt(index);
      if (c > 47 && c < 58){
        number++;
      } else if(c > 64 && c < 91){
        bigLetter++;
      } else if(c > 96 && c < 123){
        smallLetter++;
      } else {
        symbol++;
      }
    }

    let kinds = 0;
    if (number > 0) {
      kinds++;
    }
    if (smallLetter > 0) {
      kinds++;
    }
    if (bigLetter > 0) {
      kinds++;
    }
    if (symbol > 0) {
      kinds++;
    }

    if(kinds < 2){
      if(locale == 'en-US'){
        return ('The password you entered is not a strong password, please change it. '+
        '(1. The password length must be greater than 8 digits. 2 Include at least 2 of numbers, lowercase letters, uppercase letters, and special characters (~! @ # $% ^ -+).)');
      }else{
        return ('您输入的密码不是强密码，请更换密码。（1. 密码长度需要大于8位。2. 至少包括 数字、小写字母、大写字母、特殊字符（~!@#$%^-+） 中的2种。）');
      }
    }else{
      return null;
    }
  },



};