| | |
| | | private readonly IRepository<Dt_AuthorizationRecord> _AuthorizatRecServer; |
| | | private readonly IRepository<Sys_UserFace> _userFace; |
| | | |
| | | public Sys_UserService(IRepository<Sys_UserFace> _userFace,IRepository<Dt_AuthorizationRecord> AuthorizatRecServer ,IRepository<Sys_Role> RoleServer,IRepository<Dt_Loginhsy> LoginhsyServer,IRepository<Dt_FaceRecognition> faceServer, IRepository<Sys_User> repository, IUnitOfWorkManage unitOfWorkManage, ICacheService cacheService, ISys_MenuService menuService, IRepository<Dt_Maintenance> MainServer) : base(repository) |
| | | public Sys_UserService(IRepository<Sys_UserFace> userFace,IRepository<Dt_AuthorizationRecord> AuthorizatRecServer ,IRepository<Sys_Role> RoleServer,IRepository<Dt_Loginhsy> LoginhsyServer,IRepository<Dt_FaceRecognition> faceServer, IRepository<Sys_User> repository, IUnitOfWorkManage unitOfWorkManage, ICacheService cacheService, ISys_MenuService menuService, IRepository<Dt_Maintenance> MainServer) : base(repository) |
| | | { |
| | | _userFace= userFace; |
| | | _faceServer = faceServer; |
| | | _LoginhsyServer = LoginhsyServer; |
| | | _unitOfWorkManage = unitOfWorkManage; |
| | |
| | | |
| | | 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); |
| | | |
| | |
| | | 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); |
| | | |
| | |
| | | |
| | | 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 |
| | |
| | | |
| | | if (!isUpdated) |
| | | { |
| | | return content.Error("å¯ç ä¿®æ¹å¤±è´¥ï¼è¯·ç¨åéè¯"); |
| | | return content.Error("å¯ç ä¿®æ¹å¤±è´¥ï¼å¯ç å¿
é¡»å
æ¬åæ¯ä»¥åç¹æ®å符"); |
| | | } |
| | | |
| | | return content.OK("å¯ç ä¿®æ¹æå", id); |
| | |
| | | return content.Error($"æå¡å¨é误: {ex.Message}"); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | public WebResponseContent Upuserbase(UserDTO userDTO) |
| | |
| | | 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, |
| | |
| | | //{ |
| | | // ç¾åº¦å 餿ååï¼å 餿°æ®åºä¸çç¨æ· |
| | | var user = BaseDal.QueryData(x => x.UserName == account).FirstOrDefault(); |
| | | if (user==null) |
| | | { |
| | | return WebResponseContent.Instance.Error("æ²¡ææ¾å°è¯¥ç¨æ·"); |
| | | } |
| | | var main = _MainServer.QueryData(x => x.UserAccount == account).FirstOrDefault(); |
| | | var face= _userFace.QueryData(x=>x.UserName== account).FirstOrDefault(); |
| | | if (user != null && main != null&&face!=null) |
| | | if (main.MaintenanceStatus == 1) |
| | | { |
| | | return WebResponseContent.Instance.Error("è¯¥ç¨æ·è¿å¨æ£ä¿®ä¸ï¼æ æ³å é¤"); |
| | | } |
| | | if (face == null) |
| | | { |
| | | BaseDal.DeleteData(user); |
| | | _MainServer.DeleteData(main); |
| | | } |
| | | else |
| | | { |
| | | BaseDal.DeleteData(user); |
| | | _MainServer.DeleteData(main); |
| | | _userFace.DeleteData(face); |
| | | } |
| | | } |
| | | return WebResponseContent.Instance.OK("ç¨æ·å 餿å"); |
| | | //} |
| | | //else |
| | |
| | | } |
| | | var main = _MainServer.QueryData(x => x.UserAccount == user.UserName).FirstOrDefault(); |
| | | var face = _userFace.QueryData(x => x.UserName == user.UserName).FirstOrDefault(); |
| | | if (main.MaintenanceStatus == 1) |
| | | { |
| | | return WebResponseContent.Instance.Error("è¯¥ç¨æ·è¿å¨æ£ä¿®ä¸ï¼æ æ³å é¤"); |
| | | } |
| | | if (face == null) |
| | | { |
| | | BaseDal.DeleteData(user); |
| | | _MainServer.DeleteData(main); |
| | | } |
| | | BaseDal.DeleteData(user); |
| | | _MainServer.DeleteData(main); |
| | | _userFace.DeleteData(face); |
| | | else |
| | | { |
| | | BaseDal.DeleteData(user); |
| | | _MainServer.DeleteData(main); |
| | | _userFace.DeleteData(face); |
| | | } |
| | | |
| | | } |
| | | |
| | | return webResponse.OK(); |