Explorar el Código

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

yuqian %!s(int64=8) %!d(string=hace) años
padre
commit
002e2455bc

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

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

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

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
 using System.Collections.Generic;
8
 using System.Collections.Generic;
9
 using System.Data;
9
 using System.Data;
10
 using System.Linq;
10
 using System.Linq;
11
+using System.Text;
11
 using System.Web;
12
 using System.Web;
12
 using System.Web.Mvc;
13
 using System.Web.Mvc;
13
 
14
 
23
             ActionResult res = NoToken("未知错误,请重新登录");
24
             ActionResult res = NoToken("未知错误,请重新登录");
24
             //if (Request.IsAuthenticated)
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
             DataTable dt = new DataTable();
36
             DataTable dt = new DataTable();
27
             int recordCount = 0;
37
             int recordCount = 0;
28
             dt = BLL.PagerBLL.GetListPager(
38
             dt = BLL.PagerBLL.GetListPager(
29
                 "T_Sys_RoleInfo",
39
                 "T_Sys_RoleInfo",
30
                 "F_RoleId",
40
                 "F_RoleId",
31
                 "*",
41
                 "*",
32
-                " and  F_RoleName like '%" + filter.Name + "%' and F_RoleCode like '%" + filter.Code + "%'  ",
42
+                sb.ToString(),
33
                 "",
43
                 "",
34
                 filter.PageSize,
44
                 filter.PageSize,
35
                 filter.PageIndex,
45
                 filter.PageIndex,

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

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

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

8
 {
8
 {
9
     public class FilterRole : ListBase
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
 }