Skip to content

Commit

Permalink
用户密码新增非法字符验证
Browse files Browse the repository at this point in the history
  • Loading branch information
yangzongzhuan committed Mar 1, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 2dca6f0 commit 3fa4901
Showing 3 changed files with 12 additions and 4 deletions.
3 changes: 2 additions & 1 deletion ruoyi-ui/src/views/register.vue
Original file line number Diff line number Diff line change
@@ -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: "请再次输入您的密码" },
10 changes: 8 additions & 2 deletions ruoyi-ui/src/views/system/user/index.vue
Original file line number Diff line number Diff line change
@@ -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);
3 changes: 2 additions & 1 deletion ruoyi-ui/src/views/system/user/profile/resetPwd.vue
Original file line number Diff line number Diff line change
@@ -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" },

0 comments on commit 3fa4901

Please sign in to comment.