用户登录问题修改
This commit is contained in:
		
							parent
							
								
									3370b734a2
								
							
						
					
					
						commit
						305a665da2
					
				| 
						 | 
					@ -743,18 +743,53 @@ export default {
 | 
				
			||||||
      // 6. 新密码通过所有校验,返回空表示通过校验
 | 
					      // 6. 新密码通过所有校验,返回空表示通过校验
 | 
				
			||||||
      return null
 | 
					      return null
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
 | 
					 | 
				
			||||||
    containsConsecutiveCharacters(password, maxConsecutive) {
 | 
					    containsConsecutiveCharacters(password, maxConsecutive) {
 | 
				
			||||||
      let count = 1
 | 
					      let count = 1 // 初始化计数器
 | 
				
			||||||
      for (let i = 1; i < password.length; i++) {
 | 
					      let previousChar = '' // 保存上一个字符
 | 
				
			||||||
        if (password[i] === password[i - 1]) {
 | 
					      maxConsecutive = maxConsecutive + 1
 | 
				
			||||||
          count++
 | 
					      for (let i = 0; i < password.length; i++) {
 | 
				
			||||||
          if (count > maxConsecutive) return true
 | 
					        // 检查当前字符与前一个字符是否相同
 | 
				
			||||||
 | 
					        if (password[i] === previousChar) {
 | 
				
			||||||
 | 
					          count++ // 计数器加1
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
          count = 1
 | 
					          count = 1 // 如果字符不同,重置计数器
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // 检查是否超过最大连续字符数
 | 
				
			||||||
 | 
					        if (count > maxConsecutive) {
 | 
				
			||||||
 | 
					          return true
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // 检查当前字符是否是数字
 | 
				
			||||||
 | 
					        if (/\d/.test(password[i])) {
 | 
				
			||||||
 | 
					          // 检查是否有超过指定数量的连续数字
 | 
				
			||||||
 | 
					          if (i > 0 && password[i] === password[i - 1]) {
 | 
				
			||||||
 | 
					            count++ // 计数器加1
 | 
				
			||||||
 | 
					            if (count > maxConsecutive) {
 | 
				
			||||||
 | 
					              return true
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					          } else {
 | 
				
			||||||
 | 
					            count = 1 // 重置计数器
 | 
				
			||||||
 | 
					          }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // 检查当前字符是否是字母
 | 
				
			||||||
 | 
					        if (/[a-zA-Z]/.test(password[i])) {
 | 
				
			||||||
 | 
					          // 检查是否有超过指定数量的连续字母
 | 
				
			||||||
 | 
					          if (i > 0 && password[i] === password[i - 1]) {
 | 
				
			||||||
 | 
					            count++ // 计数器加1
 | 
				
			||||||
 | 
					            if (count > maxConsecutive) {
 | 
				
			||||||
 | 
					              return true
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					          } else {
 | 
				
			||||||
 | 
					            count = 1 // 重置计数器
 | 
				
			||||||
 | 
					          }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        previousChar = password[i] // 更新上一个字符
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      return false
 | 
					
 | 
				
			||||||
 | 
					      return false // 如果没有找到问题,则返回符合要求的提示
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue