Browse Source

Merge branch 'zhangrenyuan/feature-20250817091555-金币优化' into milestone-20250815-金币优化

zhangyong/feature-20250815160302-金币优化
zhangrenyuan 2 months ago
parent
commit
6e5ec1f08f
  1. 8
      src/components/changePassword.vue

8
src/components/changePassword.vue

@ -32,7 +32,9 @@ const getAccount= async function() {
}
}
//
const isLengthValid = computed(() => passwd.newPassword.length >= 8 && passwd.newPassword.length <= 16)
const isLengthValid = computed(() =>
/^[A-Za-z0-9~!@#$%^&*()_+\-=[\]{}|;:,.<>?/]{8,16}$/.test(passwd.newPassword)
);
const isComplexValid = computed(() => {
const rules = [/\d/, /[a-z]/, /[A-Z]/, /[^a-zA-Z0-9]/]
@ -62,7 +64,7 @@ const rules = reactive({
} else if (value.length < 8 || value.length > 16) {
callback(new Error('长度应在 8 到 16 个字符'))
} else {
const types = [/\d/, /[a-z]/, /[A-Z]/, /[^a-zA-Z0-9]/]
const types = [/\d/, /[a-z]/, /[A-Z]/, /[!@#$%^&*()\-_+={}[\]|\\:;"'<>,.?/~`]/];
const matchCount = types.filter((r) => r.test(value)).length
if (matchCount < 2) {
callback(new Error('密码至少包含两种类型(数字、字母或符号)'))
@ -115,7 +117,7 @@ const changePassword = async function () {
router.push('/PasswordSuccess');
}, 1000);
}else if (result.code === 0){
ElMessage.error('原密码错误')
ElMessage.error('原密码错误,请重新输入')
passwd.oldPassword = '';
}else if(result.code === 400){

Loading…
Cancel
Save