用户登录问题修改

This commit is contained in:
jiang 2024-09-14 17:34:19 +08:00
parent 3370b734a2
commit 305a665da2
1 changed files with 43 additions and 8 deletions

View File

@ -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 //
} }
} }
} }