From 7ec274fb728b9fc71e19eebb1ea07aa5036f0acc Mon Sep 17 00:00:00 2001 From: hang <87227557@qq.com> Date: Mon, 20 Jan 2025 19:53:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AF=86=E7=A0=81=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/Management/UserService.cs | 31 ++++++++++--------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Management/UserService.cs b/IRaCIS.Core.Application/Service/Management/UserService.cs index 02f76481a..c63068e14 100644 --- a/IRaCIS.Core.Application/Service/Management/UserService.cs +++ b/IRaCIS.Core.Application/Service/Management/UserService.cs @@ -7,6 +7,7 @@ using IRaCIS.Core.Application.Contracts; using IRaCIS.Core.Application.Helper; using IRaCIS.Core.Application.Service.OAuth; using IRaCIS.Core.Application.ViewModel; +using IRaCIS.Core.Domain.Models; using IRaCIS.Core.Domain.Share; using IRaCIS.Core.Infrastructure; using MassTransit; @@ -106,21 +107,7 @@ namespace IRaCIS.Core.Application.Service } - if (oldPwd == null) - { - oldPwd = await _identityUserRepository.Where(x => x.Id == identityUserId).Select(x => x.Password).FirstOrDefaultAsync(); - } - if (oldPwd.IsNotNullOrEmpty()) - { - await _userPassWordLogRepository.AddAsync(new UserPassWordLog() - { - - CreateTime = DateTime.Now, - PassWord = oldPwd!, - IdentityUserId = identityUserId, - }); - } await _identityUserRepository.BatchUpdateNoTrackingAsync(x => x.Id == identityUserId, x => new IdentityUser() { @@ -413,6 +400,14 @@ namespace IRaCIS.Core.Application.Service IsFirstAdd = false }); + await _userPassWordLogRepository.AddAsync(new UserPassWordLog() + { + + CreateTime = DateTime.Now, + PassWord = newPwd, + IdentityUserId = identityUserId, + }); + await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, ActionIdentityUserId = identityUserId, ActionUserName = _userInfo.UserName, TargetIdentityUserId = identityUserId, OptType = UserOptType.UnloginModifyPasswoed }, true); @@ -450,6 +445,14 @@ namespace IRaCIS.Core.Application.Service IsFirstAdd = false }); + await _userPassWordLogRepository.AddAsync(new UserPassWordLog() + { + + CreateTime = DateTime.Now, + PassWord = editPwModel.NewPassWord, + IdentityUserId = _userInfo.IdentityUserId, + }); + await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, ActionIdentityUserId = _userInfo.IdentityUserId, ActionUserName = _userInfo.UserName, TargetIdentityUserId = _userInfo.IdentityUserId, OptType = UserOptType.LoginModifyPassword }, true); return ResponseOutput.Result(success);