From 8c990ae9fc5490343b43a2c9738f0455d10076dd Mon Sep 17 00:00:00 2001 From: RuoYi Date: Fri, 1 Mar 2024 21:53:57 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=AF=86=E7=A0=81=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E9=9D=9E=E6=B3=95=E5=AD=97=E7=AC=A6=E9=AA=8C=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-ui/src/views/register.vue | 3 ++- ruoyi-ui/src/views/system/user/index.vue | 10 ++++++++-- ruoyi-ui/src/views/system/user/profile/resetPwd.vue | 3 ++- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/ruoyi-ui/src/views/register.vue b/ruoyi-ui/src/views/register.vue index e4f2df6f..d55f2369 100644 --- a/ruoyi-ui/src/views/register.vue +++ b/ruoyi-ui/src/views/register.vue @@ -95,7 +95,8 @@ export default { ], password: [ { required: true, trigger: "blur", message: "请输入您的密码" }, - { min: 5, max: 20, message: '用户密码长度必须介于 5 和 20 之间', trigger: 'blur' } + { min: 5, max: 20, message: "用户密码长度必须介于 5 和 20 之间", trigger: "blur" }, + { pattern: /^[^<>"'|\\]+$/, message: "不能包含非法字符:< > \" ' \\\ |", trigger: "blur" } ], confirmPassword: [ { required: true, trigger: "blur", message: "请再次输入您的密码" }, diff --git a/ruoyi-ui/src/views/system/user/index.vue b/ruoyi-ui/src/views/system/user/index.vue index bfd87207..ff798945 100644 --- a/ruoyi-ui/src/views/system/user/index.vue +++ b/ruoyi-ui/src/views/system/user/index.vue @@ -433,7 +433,8 @@ export default { ], password: [ { required: true, message: "用户密码不能为空", trigger: "blur" }, - { min: 5, max: 20, message: '用户密码长度必须介于 5 和 20 之间', trigger: 'blur' } + { min: 5, max: 20, message: '用户密码长度必须介于 5 和 20 之间', trigger: 'blur' }, + { pattern: /^[^<>"'|\\]+$/, message: "不能包含非法字符:< > \" ' \\\ |", trigger: "blur" } ], email: [ { @@ -591,7 +592,12 @@ export default { cancelButtonText: "取消", closeOnClickModal: false, inputPattern: /^.{5,20}$/, - inputErrorMessage: "用户密码长度必须介于 5 和 20 之间" + inputErrorMessage: "用户密码长度必须介于 5 和 20 之间", + inputValidator: (value) => { + if (/<|>|"|'|\||\\/.test(value)) { + return "不能包含非法字符:< > \" ' \\\ |" + } + }, }).then(({ value }) => { resetUserPwd(row.userId, value).then(response => { this.$modal.msgSuccess("修改成功,新密码是:" + value); diff --git a/ruoyi-ui/src/views/system/user/profile/resetPwd.vue b/ruoyi-ui/src/views/system/user/profile/resetPwd.vue index fcea6799..561a30ea 100644 --- a/ruoyi-ui/src/views/system/user/profile/resetPwd.vue +++ b/ruoyi-ui/src/views/system/user/profile/resetPwd.vue @@ -41,7 +41,8 @@ export default { ], newPassword: [ { required: true, message: "新密码不能为空", trigger: "blur" }, - { min: 6, max: 20, message: "长度在 6 到 20 个字符", trigger: "blur" } + { min: 6, max: 20, message: "长度在 6 到 20 个字符", trigger: "blur" }, + { pattern: /^[^<>"'|\\]+$/, message: "不能包含非法字符:< > \" ' \\\ |", trigger: "blur" } ], confirmPassword: [ { required: true, message: "确认密码不能为空", trigger: "blur" },