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

This commit is contained in:
tianyongbao
2026-06-16 22:53:25 +08:00
parent 162e00e5b7
commit b2c26603e6
3 changed files with 86 additions and 10 deletions

View File

@@ -22,15 +22,15 @@
<view class="tips-list">
<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>
<text class="tip-text">必须同时包含大写字母小写字母数字和特殊字</text>
</view>
<view class="tip-item">
<text class="tip-dot"></text>
<text class="tip-text">不要使用容易被猜到的密码</text>
<text class="tip-text">密码不能包含空格</text>
</view>
</view>
</view>
@@ -45,6 +45,7 @@
<script>
import { updateUserPwd } from "@/api/system/user"
import { validatePassword } from "@/utils/validate"
export default {
data() {
@@ -67,9 +68,8 @@
errorMessage: '新密码不能为空',
},
{
minLength: 6,
maxLength: 20,
errorMessage: '长度在 6 到 20 个字符'
validateFunction: (rule, value) => validatePassword(value).valid,
errorMessage: '新密码需 8-20 位,且须同时含大小写字母、数字和特殊字符'
}
]
},