修改前端禁止root的正则表达式,做精确匹配

pull/34/head
yumaojun 2016-01-04 13:13:13 +08:00
parent 34e8b32180
commit 38f72a85e4
2 changed files with 3 additions and 5 deletions

View File

@ -92,15 +92,14 @@ $('#roleForm').validator({
timely: 2, timely: 2,
theme: "yellow_right_effect", theme: "yellow_right_effect",
rules: { rules: {
check_name: [/^\w{2,20}$/, '大小写字母数字和下划线,2-20位'], check_name: [/(?!root)^\w{2,20}$/i, '大小写字母数字和下划线,2-20位,并且非root'],
check_name_root: [/[^rR][^oO][^oO][^tT]/, '禁止使用root用户作为系统用户这样非常危险'],
check_begin: [/^[\-]+BEGIN RSA PRIVATE KEY[\-]+/gm, 'RSA Key填写有误请检查'], check_begin: [/^[\-]+BEGIN RSA PRIVATE KEY[\-]+/gm, 'RSA Key填写有误请检查'],
}, },
fields: { fields: {
"role_name": { "role_name": {
rule: "required;check_name;check_name_root", rule: "required;check_name",
tip: "输入系统用户名称", tip: "输入系统用户名称",
ok: "", ok: "",
msg: {required: "系统用户名称必填"} msg: {required: "系统用户名称必填"}

View File

@ -94,8 +94,7 @@ $('#roleForm').validator({
timely: 2, timely: 2,
theme: "yellow_right_effect", theme: "yellow_right_effect",
rules: { rules: {
check_name: [/^\w{2,20}$/, '大小写字母数字和下划线,2-20位'], check_name: [/(?!root)^\w{2,20}$/i, '大小写字母数字和下划线,2-20位,并且非root'],
check_name_root: [/[^rR][^oO][^oO][^tT]/, '禁止使用root用户作为系统用户这样非常危险'],
check_begin: [/^[\-]+BEGIN RSA PRIVATE KEY[\-]+/gm, 'RSA Key填写有误请检查'], check_begin: [/^[\-]+BEGIN RSA PRIVATE KEY[\-]+/gm, 'RSA Key填写有误请检查'],
}, },