yanjinhui
2025-08-28 6a50daac547ebaf0c2503803626e12fbc63c0bb6
修改密码的复杂度
已修改7个文件
已添加2个文件
127 ■■■■ 文件已修改
项目代码/后端/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/Telescopic/Dt_CustomIPaddress.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/后端/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/Telescopic/Dt_Maintenance.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/后端/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Telescopic/MaintenanceController.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/后端/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Telescopic/ParametersController.cs 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/后端/WCS/WIDESEAWCS_Server/WIDESEAWCS_SystemServices/Sys_UserService.cs 60 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/后端/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/SSG/AlarmResetJob.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/后端/后台管理/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/CopilotIndices/17.12.38.29086/CodeChunks.db-shm 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/后端/后台管理/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/CopilotIndices/17.12.38.29086/CodeChunks.db-wal 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/后端/后台管理/WIDESEAWCS_Server/WIDESEAWCS_SystemServices/Sys_UserService.cs 58 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ÏîÄ¿´úÂë/ºó¶Ë/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/Telescopic/Dt_CustomIPaddress.cs
@@ -15,7 +15,7 @@
        [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnDescription = "主键")]
        public  int  ID { get; set; }
        [SugarColumn(IsNullable = true, Length = 50, ColumnDescription = "IP地址")]
        [SugarColumn(IsNullable = true,ColumnDescription = "IP地址")]
        public string  IPaddress { get; set; }
        [SugarColumn(IsNullable = true, Length = 50, ColumnDescription = "自定义ip地址的中文名字")]
ÏîÄ¿´úÂë/ºó¶Ë/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/Telescopic/Dt_Maintenance.cs
@@ -56,7 +56,7 @@
        public int MaintenanceStatus{ get; set; }
        [SugarColumn(IsNullable = true, Length = 50, ColumnDescription = "轨道站专属id")]
        [SugarColumn(IsNullable = true, ColumnDescription = "轨道站专属id")]
        public int? StationID { get; set; }
        /// <summary>
ÏîÄ¿´úÂë/ºó¶Ë/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Telescopic/MaintenanceController.cs
@@ -120,7 +120,7 @@
        {
            var userIp = HttpContext.GetUserIp();//用户电脑ip
            var reslut = userIp.Replace("::ffff:","");
            return Service.StopMaintenanceTask(account, userIp);
            return Service.StopMaintenanceTask(account, reslut);
        }
ÏîÄ¿´úÂë/ºó¶Ë/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Telescopic/ParametersController.cs
@@ -15,6 +15,7 @@
    [ApiController]
    public class ParametersController : ApiBaseController<IParametersService, Dt_Parameters>
    {
        public ParametersController(IParametersService service) : base(service)
        {
@@ -29,6 +30,7 @@
        [HttpPost, Route("ManualOperation")]
        public  WebResponseContent ManualOperation(string position, string ExtendedState)
        {
            var userIp = HttpContext.GetUserIp();//用户电脑ip
            var reslut = userIp.Replace("::ffff:", "");
            return Service.ManualOperation(position, ExtendedState, reslut);
ÏîÄ¿´úÂë/ºó¶Ë/WCS/WIDESEAWCS_Server/WIDESEAWCS_SystemServices/Sys_UserService.cs
@@ -14,6 +14,7 @@
using Microsoft.AspNetCore.Http;
using Newtonsoft.Json;
using WIDESEAWCS_Common;
using FaceAI;
using System.Runtime.InteropServices;
using System.IO;
@@ -365,9 +366,26 @@
                if (string.IsNullOrEmpty(oldPwd)) return WebResponseContent.Instance.Error("旧密码不能为空");
                if (string.IsNullOrEmpty(newPwd)) return WebResponseContent.Instance.Error("新密码不能为空");
                if (newPwd.Length < 6) return WebResponseContent.Instance.Error("密码不能少于6位");
                int userId = App.User.UserId;
                string userCurrentPwd = BaseDal.QueryFirst(x => x.User_Id == userId, s => s.UserPwd);
                // âœ… å¯†ç å¤æ‚度校验:必须包含字母和数字
                // âœ… å¯†ç å¤æ‚度校验:必须包含大小写字母、数字和特殊符号
                if (!global::System.Text.RegularExpressions.Regex.IsMatch(newPwd, @"[a-z]"))
                    return content.Error("新密码必须包含小写字母");
                if (!global::System.Text.RegularExpressions.Regex.IsMatch(newPwd, @"[A-Z]"))
                    return content.Error("新密码必须包含大写字母");
                if (!global::System.Text.RegularExpressions.Regex.IsMatch(newPwd, @"\d"))
                    return content.Error("新密码必须包含数字");
                // âœ… å¯†ç å¤æ‚度校验:必须包含至少一个特殊符号(非字母数字的都算)
                if (!global::System.Text.RegularExpressions.Regex.IsMatch(newPwd, @"[^a-zA-Z0-9]"))
                    return content.Error("新密码必须包含至少一个特殊符号");
                string _oldPwd = oldPwd.EncryptDES(AppSecret.User);
                if (_oldPwd != userCurrentPwd) return WebResponseContent.Instance.Error("旧密码不正确");
@@ -403,7 +421,7 @@
        /// <param name="id"></param>
        /// <param name="oldPwd"></param>
        /// <param name="newPwd"></param>
        /// <returns></returns>
        /// <returns></returns>
        public WebResponseContent UpdatePwd(int id, string oldPwd, string newPwd)
        {
            WebResponseContent content = new WebResponseContent();
@@ -412,22 +430,44 @@
            try
            {
                if (string.IsNullOrEmpty(oldPwd)) return content.Error("旧密码不能为空");
                if (string.IsNullOrEmpty(newPwd)) return content.Error("新密码不能为空");
                if (newPwd.Length < 6) return content.Error("密码不能少于6位");
                if (string.IsNullOrEmpty(oldPwd))
                    return content.Error("旧密码不能为空");
                if (string.IsNullOrEmpty(newPwd))
                    return content.Error("新密码不能为空");
                if (newPwd.Length < 6)
                    return content.Error("密码不能少于6位");
                // âœ… å¯†ç å¤æ‚度校验:必须包含大小写字母、数字和特殊符号
                if (!global::System.Text.RegularExpressions.Regex.IsMatch(newPwd, @"[a-z]"))
                    return content.Error("新密码必须包含小写字母");
                if (!global::System.Text.RegularExpressions.Regex.IsMatch(newPwd, @"[A-Z]"))
                    return content.Error("新密码必须包含大写字母");
                if (!global::System.Text.RegularExpressions.Regex.IsMatch(newPwd, @"\d"))
                    return content.Error("新密码必须包含数字");
                // âœ… å¯†ç å¤æ‚度校验:必须包含至少一个特殊符号(非字母数字的都算)
                if (!global::System.Text.RegularExpressions.Regex.IsMatch(newPwd, @"[^a-zA-Z0-9]"))
                    return content.Error("新密码必须包含至少一个特殊符号");
                // èŽ·å–ç”¨æˆ·å½“å‰å¯†ç 
                string userCurrentPwd = BaseDal.QueryFirst(x => x.User_Id == id, s => s.UserPwd) ?? "";
                if (string.IsNullOrEmpty(userCurrentPwd)) return content.Error("用户不存在或密码未设置");
                if (string.IsNullOrEmpty(userCurrentPwd))
                    return content.Error("用户不存在或密码未设置");
                //// è¿›è¡Œå¯†ç åŠ å¯†å¯¹æ¯”
                //// å¦‚果需要验证旧密码,放开这里
                //string _oldPwd = oldPwd.EncryptDES(AppSecret.User);
                //if (_oldPwd != userCurrentPwd) return content.Error("旧密码不正确");
                //if (_oldPwd != userCurrentPwd)
                //    return content.Error("旧密码不正确");
                // ç”Ÿæˆæ–°å¯†ç åР坆值
                string _newPwd = newPwd.EncryptDES(AppSecret.User);
                if (userCurrentPwd == _newPwd) return content.Error("新密码不能与旧密码相同");
                if (userCurrentPwd == _newPwd)
                    return content.Error("新密码不能与旧密码相同");
                // æ›´æ–°å¯†ç 
                bool isUpdated = BaseDal.UpdateData(new Sys_User
@@ -443,7 +483,7 @@
                if (!isUpdated)
                {
                    return content.Error("密码修改失败,请稍后重试");
                    return content.Error("密码修改失败,密码必须包括字母以及特殊字符");
                }
                return content.OK("密码修改成功", id);
@@ -570,7 +610,7 @@
                    RoleName = addUserDTO.rolename,
                    Enable = addUserDTO.enable,
                    Unit=addUserDTO.userunit,
                    UserPwd = "j79rYYvCz4vdhcboB1Ausg==",
                    UserPwd = "NgKc7vI5u5jzh115fowV~g==",
                    Userteam=addUserDTO.userteam,
                    Dept_Id=addUserDTO.dept_Id,
                    //CardNumber=addUserDTO.carnuber,
ÏîÄ¿´úÂë/ºó¶Ë/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/SSG/AlarmResetJob.cs
@@ -87,7 +87,6 @@
                        //var devices = GetDevicesByDeptId(deid);
                        if (devices != null)
                        {
                            // Left PLC processing
ÏîÄ¿´úÂë/ºó¶Ë/ºǫ́¹ÜÀí/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/CopilotIndices/17.12.38.29086/CodeChunks.db-shm
Binary files differ
ÏîÄ¿´úÂë/ºó¶Ë/ºǫ́¹ÜÀí/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/CopilotIndices/17.12.38.29086/CodeChunks.db-wal
Binary files differ
ÏîÄ¿´úÂë/ºó¶Ë/ºǫ́¹ÜÀí/WIDESEAWCS_Server/WIDESEAWCS_SystemServices/Sys_UserService.cs
@@ -306,7 +306,7 @@
        public override WebResponseContent AddData(SaveModel saveModel)
        {
            string pwd = "123456";
            string pwd = "Gns1234+";
            string uesrName = saveModel.MainData[nameof(Sys_User.UserName).FirstLetterToLower()].ToString();
            saveModel.MainData[nameof(Sys_User.UserPwd).FirstLetterToLower()] = pwd.EncryptDES(AppSecret.User);
@@ -360,6 +360,20 @@
                if (string.IsNullOrEmpty(newPwd)) return WebResponseContent.Instance.Error("新密码不能为空");
                if (newPwd.Length < 6) return WebResponseContent.Instance.Error("密码不能少于6位");
                // âœ… å¯†ç å¤æ‚度校验:必须包含大小写字母、数字和特殊符号
                if (!global::System.Text.RegularExpressions.Regex.IsMatch(newPwd, @"[a-z]"))
                    return content.Error("新密码必须包含小写字母");
                if (!global::System.Text.RegularExpressions.Regex.IsMatch(newPwd, @"[A-Z]"))
                    return content.Error("新密码必须包含大写字母");
                if (!global::System.Text.RegularExpressions.Regex.IsMatch(newPwd, @"\d"))
                    return content.Error("新密码必须包含数字");
                // ç‰¹æ®Šç¬¦å·ï¼ˆæ ‡ç‚¹ï¼‰ï¼Œæ¯”如 . ! @ # $ % ^ & * ( ) _ - + = ...
                if (!global::System.Text.RegularExpressions.Regex.IsMatch(newPwd, @"[!@#$%^&*(),.?""':{}|<>_\-+=\\/\[\]~`]"))
                    return content.Error("新密码必须包含至少一个特殊符号");
                int userId = App.User.UserId;
                string userCurrentPwd = BaseDal.QueryFirst(x => x.User_Id == userId, s => s.UserPwd);
@@ -406,22 +420,45 @@
            try
            {
                if (string.IsNullOrEmpty(oldPwd)) return content.Error("旧密码不能为空");
                if (string.IsNullOrEmpty(newPwd)) return content.Error("新密码不能为空");
                if (newPwd.Length < 6) return content.Error("密码不能少于6位");
                if (string.IsNullOrEmpty(oldPwd))
                    return content.Error("旧密码不能为空");
                if (string.IsNullOrEmpty(newPwd))
                    return content.Error("新密码不能为空");
                if (newPwd.Length < 6)
                    return content.Error("密码不能少于6位");
                // âœ… å¯†ç å¤æ‚度校验:必须包含大小写字母、数字和特殊符号
                if (!global::System.Text.RegularExpressions.Regex.IsMatch(newPwd, @"[a-z]"))
                    return content.Error("新密码必须包含小写字母");
                if (!global::System.Text.RegularExpressions.Regex.IsMatch(newPwd, @"[A-Z]"))
                    return content.Error("新密码必须包含大写字母");
                if (!global::System.Text.RegularExpressions.Regex.IsMatch(newPwd, @"\d"))
                    return content.Error("新密码必须包含数字");
                // ç‰¹æ®Šç¬¦å·ï¼ˆæ ‡ç‚¹ï¼‰ï¼Œæ¯”如 . ! @ # $ % ^ & * ( ) _ - + = ...
                if (!global::System.Text.RegularExpressions.Regex.IsMatch(newPwd, @"[^a-zA-Z0-9]"))
                    return content.Error("新密码必须包含至少一个特殊符号");
                // èŽ·å–ç”¨æˆ·å½“å‰å¯†ç 
                string userCurrentPwd = BaseDal.QueryFirst(x => x.User_Id == id, s => s.UserPwd) ?? "";
                if (string.IsNullOrEmpty(userCurrentPwd)) return content.Error("用户不存在或密码未设置");
                if (string.IsNullOrEmpty(userCurrentPwd))
                    return content.Error("用户不存在或密码未设置");
                //// è¿›è¡Œå¯†ç åŠ å¯†å¯¹æ¯”
                //// å¦‚果需要验证旧密码,放开这里
                //string _oldPwd = oldPwd.EncryptDES(AppSecret.User);
                //if (_oldPwd != userCurrentPwd) return content.Error("旧密码不正确");
                //if (_oldPwd != userCurrentPwd)
                //    return content.Error("旧密码不正确");
                // ç”Ÿæˆæ–°å¯†ç åР坆值
                string _newPwd = newPwd.EncryptDES(AppSecret.User);
                if (userCurrentPwd == _newPwd) return content.Error("新密码不能与旧密码相同");
                if (userCurrentPwd == _newPwd)
                    return content.Error("新密码不能与旧密码相同");
                // æ›´æ–°å¯†ç 
                bool isUpdated = BaseDal.UpdateData(new Sys_User
@@ -437,7 +474,7 @@
                if (!isUpdated)
                {
                    return content.Error("密码修改失败,请稍后重试");
                    return content.Error("密码修改失败,密码必须包括字母以及特殊字符");
                }
                return content.OK("密码修改成功", id);
@@ -448,6 +485,7 @@
                return content.Error($"服务器错误: {ex.Message}");
            }
        }
        public WebResponseContent Upuserbase(UserDTO userDTO)
@@ -564,7 +602,7 @@
                    RoleName = addUserDTO.rolename,
                    Enable = addUserDTO.enable,
                    Unit = addUserDTO.userunit,
                    UserPwd = "j79rYYvCz4vdhcboB1Ausg==",
                    UserPwd = "NgKc7vI5u5jzh115fowV~g==",
                    Userteam = addUserDTO.userteam,
                    Dept_Id = addUserDTO.dept_Id,
                    //CardNumber=addUserDTO.carnuber,