fix:修改密码功能
parent
aac5779741
commit
aee253e972
|
|
@ -101,11 +101,17 @@ const emailCodeLoading = ref(false)
|
|||
const emailCodeCountdown = ref(0)
|
||||
let emailCodeTimer: ReturnType<typeof setInterval> | null = null
|
||||
|
||||
const passwordPattern = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[^A-Za-z0-9]).{8,20}$/
|
||||
const validatePassword = (value: string) => {
|
||||
if (!value) return true
|
||||
if (value.length < 8 || value.length > 20) return false
|
||||
|
||||
const ruleCount = [/[A-Z]/, /[a-z]/, /\d/, /[^A-Za-z0-9]/].filter((pattern) => pattern.test(value)).length
|
||||
return ruleCount >= 3
|
||||
}
|
||||
|
||||
const newPasswordRules = [
|
||||
{ required: true, message: '请输入新密码' },
|
||||
{ pattern: passwordPattern, message: '不符合密码规则' }
|
||||
{ validator: validatePassword, message: '密码需为8-20位,且大写字母、小写字母、数字、特殊符号至少满足3种' }
|
||||
]
|
||||
|
||||
const confirmPasswordRules = [
|
||||
|
|
|
|||
Loading…
Reference in New Issue