用户登录问题修改

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.
return null
},
containsConsecutiveCharacters(password, maxConsecutive) {
let count = 1
for (let i = 1; i < password.length; i++) {
if (password[i] === password[i - 1]) {
count++
if (count > maxConsecutive) return true
let count = 1 //
let previousChar = '' //
maxConsecutive = maxConsecutive + 1
for (let i = 0; i < password.length; i++) {
//
if (password[i] === previousChar) {
count++ // 1
} 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 //
}
}
}