From 782270d4621c72837317e13a4c8354cc3eba00c3 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Mon, 26 Jan 2026 10:58:29 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=A8=E6=88=B7MFA=20=E7=BC=93=E5=AD=98?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0tag=EF=BC=8C=E9=87=8D=E7=BD=AE=E5=AF=86?= =?UTF-8?q?=E7=A0=81=EF=BC=8C=E4=BF=AE=E6=94=B9=E5=AF=86=E7=A0=81=E6=B8=85?= =?UTF-8?q?=E6=A5=9A=E8=AF=A5tag=E7=9A=84=E7=BC=93=E5=AD=98=EF=BC=8C?= =?UTF-8?q?=E4=BB=8E=E8=80=8C=E7=99=BB=E5=BD=95=E6=97=B6=E9=9C=80=E8=A6=81?= =?UTF-8?q?=E9=AA=8C=E8=AF=81MFA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.Application/Helper/CacheHelper.cs | 2 ++ IRaCIS.Core.Application/IRaCIS.Core.Application.xml | 7 +++++++ .../Service/Management/UserService.cs | 13 ++++++++++--- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/IRaCIS.Core.Application/Helper/CacheHelper.cs b/IRaCIS.Core.Application/Helper/CacheHelper.cs index 850d7be88..15bf0008b 100644 --- a/IRaCIS.Core.Application/Helper/CacheHelper.cs +++ b/IRaCIS.Core.Application/Helper/CacheHelper.cs @@ -64,6 +64,8 @@ public static class CacheKeys //每个用户 每个浏览器独立时间 public static string UserMFAVerifyPass(Guid userId,string browserFingerprint) => $"UserMFAVerifyPass:{userId}:{browserFingerprint}"; + public static string UserMFATag(Guid userId) => $"UserMFAVerifyPass:{userId}"; + } public static class CacheHelper diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index c088abee4..4dcc59184 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -19195,6 +19195,13 @@ + + + 更新缩略图路径 + + + + 指定资源Id,获取Dicom检查所属序列信息列表 Dicom检查的Id diff --git a/IRaCIS.Core.Application/Service/Management/UserService.cs b/IRaCIS.Core.Application/Service/Management/UserService.cs index bb5a73685..62d89c426 100644 --- a/IRaCIS.Core.Application/Service/Management/UserService.cs +++ b/IRaCIS.Core.Application/Service/Management/UserService.cs @@ -308,6 +308,8 @@ namespace IRaCIS.Core.Application.Service await _fusionCache.RemoveAsync(CacheKeys.UserLoginError(userName)); + await _fusionCache.RemoveByTagAsync(CacheKeys.UserMFATag(identityUserId)); + await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, ActionIdentityUserId = _userInfo.IdentityUserId, ActionUserName = _userInfo.UserName, TargetIdentityUserId = identityUserId, OptType = UserOptType.ResetPassword }, true); return ResponseOutput.Ok(); @@ -316,7 +318,7 @@ namespace IRaCIS.Core.Application.Service /// - /// 重置密码发邮件 (未登陆修改) + /// 重置密码发邮件 (未登陆修改-忘记密码) /// /// /// @@ -357,6 +359,8 @@ namespace IRaCIS.Core.Application.Service await _mailVerificationService.AnolymousSendEmailForResetAccount(email, verificationCode); + await _fusionCache.RemoveByTagAsync(CacheKeys.UserMFATag(existUser.Id)); + return ResponseOutput.Ok(); } @@ -485,6 +489,8 @@ namespace IRaCIS.Core.Application.Service await _mailVerificationService.AfterUserModifyPasswordSendEmailAsync(_userInfo.IdentityUserId); + await _fusionCache.RemoveByTagAsync(CacheKeys.UserMFATag(_userInfo.IdentityUserId)); + return ResponseOutput.Result(success); @@ -861,7 +867,8 @@ namespace IRaCIS.Core.Application.Service if (isRemember) { - await _fusionCache.SetAsync(CacheKeys.UserMFAVerifyPass(identityUserId, _userInfo.BrowserFingerprint), _userInfo.BrowserFingerprint, TimeSpan.FromMinutes(_serviceVerifyConfigConfig.UserMFAVerifyMinutes)); + await _fusionCache.SetAsync(CacheKeys.UserMFAVerifyPass(identityUserId, _userInfo.BrowserFingerprint), _userInfo.BrowserFingerprint, + TimeSpan.FromMinutes(_serviceVerifyConfigConfig.UserMFAVerifyMinutes), new[] { CacheKeys.UserMFATag(identityUserId) }); Log.Logger.Warning($"MFA登录记录:{_userInfo.UserName} 浏览器标识: {_userInfo.BrowserFingerprint} 设置缓存分钟{_serviceVerifyConfigConfig.UserMFAVerifyMinutes}"); } @@ -1176,7 +1183,7 @@ namespace IRaCIS.Core.Application.Service if (_verifyConfig.CurrentValue.OpenLoginMFA) { - + if ((await _fusionCache.GetOrDefaultAsync(CacheKeys.UserMFAVerifyPass(identityUserId, _userInfo.BrowserFingerprint), "")) == _userInfo.BrowserFingerprint) { userLoginReturnModel.IsMFA = false;