feat(auth): 新增密码复杂度校验,注册与修改密码统一为8-20位且须含大小写字母/数字/特殊字符

This commit is contained in:
tianyongbao
2026-06-16 22:53:25 +08:00
parent 1ff68c1f98
commit 973ad0fc58
3 changed files with 86 additions and 10 deletions

View File

@@ -33,7 +33,15 @@
</view>
<view class="tip-item">
<text class="tip-dot"></text>
<text class="tip-text">密码长度为 6-20 个字符</text>
<text class="tip-text">密码长度为 8-20 个字符</text>
</view>
<view class="tip-item">
<text class="tip-dot"></text>
<text class="tip-text">必须同时包含大写字母小写字母数字和特殊字符</text>
</view>
<view class="tip-item">
<text class="tip-dot"></text>
<text class="tip-text">密码不能包含空格</text>
</view>
<view class="tip-item">
<text class="tip-dot"></text>
@@ -60,6 +68,7 @@
<script>
import { register } from "@/api/login"
import { validatePassword } from "@/utils/validate"
export default {
data() {
return {
@@ -90,9 +99,8 @@
errorMessage: '密码不能为空',
},
{
minLength: 6,
maxLength: 20,
errorMessage: '长度在 6 到 20 个字符'
validateFunction: (rule, value) => validatePassword(value).valid,
errorMessage: '密码需 8-20 位,且须同时含大小写字母、数字和特殊字符'
}
]
},