Просмотр исходного кода

角色列表接口调整; 密码验证调整

yuqian лет назад: 8
Родитель
Сommit
002e2455bc

+ 1 - 0
CallCenterApi/CallCenterApi.Common/CallCenterApi.Common.csproj

@@ -51,6 +51,7 @@
51 51
     <Compile Include="DESEncrypt.cs" />
52 52
     <Compile Include="DTRequest.cs" />
53 53
     <Compile Include="Properties\AssemblyInfo.cs" />
54
+    <Compile Include="RegexHelper.cs" />
54 55
     <Compile Include="SysConfigHelper.cs" />
55 56
     <Compile Include="Utils.cs" />
56 57
     <Compile Include="XmlFormatHelper.cs" />

+ 18 - 0
CallCenterApi/CallCenterApi.Common/RegexHelper.cs

@@ -0,0 +1,18 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Linq;
4
+using System.Text;
5
+using System.Text.RegularExpressions;
6
+using System.Threading.Tasks;
7
+
8
+namespace CallCenterApi.Common
9
+{
10
+    public class RegexHelper
11
+    {
12
+        public static readonly string Reg_Pwd = @"^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{6,16}$";
13
+        public static bool RegexPwd(string password)
14
+        {
15
+            return Regex.IsMatch(password, Reg_Pwd);
16
+        }
17
+    }
18
+}

+ 11 - 1
CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/RoleInfoController.cs

@@ -8,6 +8,7 @@ using System;
8 8
 using System.Collections.Generic;
9 9
 using System.Data;
10 10
 using System.Linq;
11
+using System.Text;
11 12
 using System.Web;
12 13
 using System.Web.Mvc;
13 14
 
@@ -23,13 +24,22 @@ namespace CallCenterApi.Interface.Controllers
23 24
             ActionResult res = NoToken("未知错误,请重新登录");
24 25
             //if (Request.IsAuthenticated)
25 26
             //{
27
+            StringBuilder sb = new StringBuilder();
28
+            if (!string.IsNullOrWhiteSpace(filter.Name))
29
+            {
30
+                sb.Append(" and  F_RoleName like '%" + filter.Name ?? "" + "%' ");
31
+            }
32
+            if (!string.IsNullOrWhiteSpace(filter.Code))
33
+            {
34
+                sb.Append(" and F_RoleCode like '%" + filter.Code ?? "" + "%'  ");
35
+            }
26 36
             DataTable dt = new DataTable();
27 37
             int recordCount = 0;
28 38
             dt = BLL.PagerBLL.GetListPager(
29 39
                 "T_Sys_RoleInfo",
30 40
                 "F_RoleId",
31 41
                 "*",
32
-                " and  F_RoleName like '%" + filter.Name + "%' and F_RoleCode like '%" + filter.Code + "%'  ",
42
+                sb.ToString(),
33 43
                 "",
34 44
                 filter.PageSize,
35 45
                 filter.PageIndex,

+ 8 - 4
CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/UserAccountController.cs

@@ -172,6 +172,10 @@ namespace CallCenterApi.Interface.Controllers
172 172
             ActionResult res = NoToken("未知错误,请重新登录");
173 173
             if (Request.IsAuthenticated)
174 174
             {
175
+                if (!RegexHelper.RegexPwd(input.Password.Trim()))
176
+                    return Error("密码必须为6-16个字符,大、小写字母和数字的组合");
177
+
178
+
175 179
                 var model = sysUserAccountBll.GetModel(int.Parse(input.Usercode));
176 180
                 if (model != null)
177 181
                     return Error("当前员工工号存在,请更换!");
@@ -435,8 +439,8 @@ namespace CallCenterApi.Interface.Controllers
435 439
             var res = NoToken("未知错误,请重新登录");
436 440
             if (Request.IsAuthenticated)
437 441
             {
438
-                if (string.IsNullOrWhiteSpace(pwd))
439
-                    return Error("请输入密码");
442
+                if (!RegexHelper.RegexPwd(pwd))
443
+                    return Error("密码必须为6-16个字符,大、小写字母和数字的组合");
440 444
                 var model = sysUserAccountBll.GetModel(usercode);
441 445
                 if (model == null) return Error("此用户不存在");
442 446
                 model.F_Password = pwd;
@@ -453,8 +457,8 @@ namespace CallCenterApi.Interface.Controllers
453 457
             var res = NoToken("未知错误,请重新登录");
454 458
             if (Request.IsAuthenticated)
455 459
             {
456
-                if (string.IsNullOrWhiteSpace(pwd))
457
-                    return Error("请输入密码");
460
+                if (!RegexHelper.RegexPwd(pwd))
461
+                    return Error("密码必须为6-16个字符,大、小写字母和数字的组合");
458 462
                 if (string.IsNullOrWhiteSpace(usercode))
459 463
                     return Error("账号错误");
460 464
                 var model = sysUserAccountBll.GetModel(int.Parse(usercode));

+ 2 - 2
CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Models/Filter/FilterRole.cs

@@ -8,8 +8,8 @@ namespace CallCenterApi.Interface.Models.Filter
8 8
 {
9 9
     public class FilterRole : ListBase
10 10
     {
11
-        public string Name { get; set; }
12
-        public string Code { get; set; }
11
+        public string Name { get; set; } = "";
12
+        public string Code { get; set; } = "";
13 13
 
14 14
     }
15 15
 }