This commit is contained in:
dataeaseShu
2025-09-02 12:00:26 +08:00
3 changed files with 12 additions and 3 deletions
+8 -1
View File
@@ -9,13 +9,18 @@ const pwdForm = reactive({
new_pwd: '',
confirm_pwd: '',
})
const PWD_REGEX =
/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[~!@#$%^&*()_+\-={}|:"<>?`\[\];',./])[A-Za-z\d~!@#$%^&*()_+\-={}|:"<>?`\[\];',./]{8,20}$/
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const validatePass = (rule: any, value: any, callback: any) => {
if (value === '') {
callback(new Error(t('common.please_input', { msg: t('user.upgrade_pwd.new_pwd') })))
} else {
if (!PWD_REGEX.test(value)) {
callback(new Error(t('user.upgrade_pwd.pwd_format_error')))
return
}
if (pwdForm.confirm_pwd !== '') {
if (!pwdRef.value) return
pwdRef.value.validateField('confirm_pwd')
@@ -28,6 +33,8 @@ const validatePass = (rule: any, value: any, callback: any) => {
const validatePass2 = (rule: any, value: any, callback: any) => {
if (value === '') {
callback(new Error(t('common.please_input', { msg: t('user.upgrade_pwd.confirm_pwd') })))
} else if (!PWD_REGEX.test(value)) {
callback(new Error(t('user.upgrade_pwd.pwd_format_error')))
} else if (value !== pwdForm.new_pwd) {
callback(new Error(t('user.upgrade_pwd.two_pwd_not_match')))
} else {
+2 -1
View File
@@ -386,7 +386,8 @@
"old_pwd": "Old password",
"new_pwd": "New password",
"confirm_pwd": "Confirm password",
"two_pwd_not_match": "The two passwords do not match"
"two_pwd_not_match": "The two passwords do not match",
"pwd_format_error": "8-20 characters including uppercase, lowercase, number, and special character"
}
},
"workspace": {
+2 -1
View File
@@ -386,7 +386,8 @@
"old_pwd": "旧密码",
"new_pwd": "新密码",
"confirm_pwd": "确认密码",
"two_pwd_not_match": "两次输入的密码不一致"
"two_pwd_not_match": "两次输入的密码不一致",
"pwd_format_error": "8-20位且至少一位大写字母、小写字母、数字、特殊字符"
}
},
"workspace": {