用户登录问题修改

This commit is contained in:
jiang 2024-09-13 16:36:46 +08:00
parent e94ea40959
commit 3370b734a2
2 changed files with 14 additions and 15 deletions

View File

@ -9,7 +9,6 @@ import { saveAs } from 'file-saver'
import { encryptCBC, decryptCBC } from '@/utils/aescbc' import { encryptCBC, decryptCBC } from '@/utils/aescbc'
import { CONFIG } from '@/utils/configure' import { CONFIG } from '@/utils/configure'
import { hashWithSM3AndSalt } from '@/utils/sm' import { hashWithSM3AndSalt } from '@/utils/sm'
import data from '@/views/system/dict/data.vue'
//let token = localStorage.getItem("tokens"); //let token = localStorage.getItem("tokens");

View File

@ -199,32 +199,32 @@ export function validateNewPassword(rule, value, callback) {
} }
function containsConsecutiveCharacters(password, maxConsecutive) { function containsConsecutiveCharacters(password, maxConsecutive) {
let count = 1; // 初始化计数器 let count = 1 // 初始化计数器
let previousChar = ""; // 保存上一个字符 let previousChar = '' // 保存上一个字符
maxConsecutive = maxConsecutive + 1
for (let i = 0; i < password.length; i++) { for (let i = 0; i < password.length; i++) {
// 检查当前字符与前一个字符是否相同 // 检查当前字符与前一个字符是否相同
if (password[i] === previousChar) { if (password[i] === previousChar) {
count++; // 计数器加1 count++ // 计数器加1
} else { } else {
count = 1; // 如果字符不同,重置计数器 count = 1 // 如果字符不同,重置计数器
} }
// 检查是否超过最大连续字符数 // 检查是否超过最大连续字符数
if (count > maxConsecutive) { if (count > maxConsecutive) {
return true; return true
} }
// 检查当前字符是否是数字 // 检查当前字符是否是数字
if (/\d/.test(password[i])) { if (/\d/.test(password[i])) {
// 检查是否有超过指定数量的连续数字 // 检查是否有超过指定数量的连续数字
if (i > 0 && password[i] === password[i - 1]) { if (i > 0 && password[i] === password[i - 1]) {
count++; // 计数器加1 count++ // 计数器加1
if (count > maxConsecutive) { if (count > maxConsecutive) {
return true; return true
} }
} else { } else {
count = 1; // 重置计数器 count = 1 // 重置计数器
} }
} }
@ -232,18 +232,18 @@ function containsConsecutiveCharacters(password, maxConsecutive) {
if (/[a-zA-Z]/.test(password[i])) { if (/[a-zA-Z]/.test(password[i])) {
// 检查是否有超过指定数量的连续字母 // 检查是否有超过指定数量的连续字母
if (i > 0 && password[i] === password[i - 1]) { if (i > 0 && password[i] === password[i - 1]) {
count++; // 计数器加1 count++ // 计数器加1
if (count > maxConsecutive) { if (count > maxConsecutive) {
return true; return true
} }
} else { } else {
count = 1; // 重置计数器 count = 1 // 重置计数器
} }
} }
previousChar = password[i]; // 更新上一个字符 previousChar = password[i] // 更新上一个字符
} }
return false; // 如果没有找到问题,则返回符合要求的提示 return false // 如果没有找到问题,则返回符合要求的提示
} }