From 5060a3e0aa6e7f9bf6d1b9ceb7da859f96d4111b Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Fri, 15 Mar 2019 17:07:38 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E6=9E=84=E4=BB=A3=E7=A0=81=EF=BC=9Alo?= =?UTF-8?q?ngbow.validate=E7=BB=84=E4=BB=B6=E5=A2=9E=E5=8A=A0userName?= =?UTF-8?q?=E6=A3=80=E6=9F=A5=E8=A7=84=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #Comment 增加正则表达式检查用户名/^[a-zA-Z0-9_@.]*$/ --- Bootstrap.Admin/wwwroot/lib/longbow/longbow.validate.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Bootstrap.Admin/wwwroot/lib/longbow/longbow.validate.js b/Bootstrap.Admin/wwwroot/lib/longbow/longbow.validate.js index 145a2d99..3f50e630 100644 --- a/Bootstrap.Admin/wwwroot/lib/longbow/longbow.validate.js +++ b/Bootstrap.Admin/wwwroot/lib/longbow/longbow.validate.js @@ -275,6 +275,9 @@ $.validator.addMethod("radioGroup", function (value, element) { return $(element).find(':checked').length === 1; }, "请选择一个选项"); + $.validator.addMethod("userName", function (value, element) { + return this.optional(element) || /^[a-zA-Z0-9_@.]*$/.test(value); + }, "登录名称不可以包含非法字符"); } $('[data-toggle="LgbValidate"]').lgbValidate(); });