增加打手密码强度校验

This commit is contained in:
yml2213
2026-08-17 15:02:33 +08:00
parent 18dad9b0fe
commit 8d18daa0fe
7 changed files with 80 additions and 9 deletions
@@ -0,0 +1,15 @@
export const WORKER_PASSWORD_MIN_LENGTH = 6
export const WORKER_PASSWORD_RULE_MESSAGE =
'密码至少 6 位,且必须包含大写字母、小写字母、数字和标点符号'
export function isWorkerPasswordStrong(value: unknown): boolean {
const password = String(value || '')
return (
password.length >= WORKER_PASSWORD_MIN_LENGTH &&
/[A-Z]/.test(password) &&
/[a-z]/.test(password) &&
/\d/.test(password) &&
/[\p{P}\p{S}]/u.test(password)
)
}