From ecfc603dda04c49521a3143ccd7d03ec7ae2d1a3 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Fri, 3 Jan 2025 09:34:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9mfa=20=E7=99=BB=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.API/appsettings.Test_IRC.json | 2 +- IRaCIS.Core.Application/IRaCIS.Core.Application.xml | 7 ++++--- .../Service/Management/UserService.cs | 9 +++------ IRaCIS.Core.Application/TestService.cs | 2 +- 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/IRaCIS.Core.API/appsettings.Test_IRC.json b/IRaCIS.Core.API/appsettings.Test_IRC.json index 8ac7cdae1..5d4d15558 100644 --- a/IRaCIS.Core.API/appsettings.Test_IRC.json +++ b/IRaCIS.Core.API/appsettings.Test_IRC.json @@ -65,7 +65,7 @@ "AutoLoginOutMinutes": 1, - "OpenLoginMFA": false, + "OpenLoginMFA": true, "ContinuousReadingTimeMin": 120, diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index 55e0fa0f3..ea66877a7 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -2273,7 +2273,7 @@ 发送MFA 验证邮件 - + @@ -2281,7 +2281,7 @@ 验证MFA 邮件 - + @@ -12058,11 +12058,12 @@ - + 删除表格问题标记 + diff --git a/IRaCIS.Core.Application/Service/Management/UserService.cs b/IRaCIS.Core.Application/Service/Management/UserService.cs index 670b21983..a84f6f154 100644 --- a/IRaCIS.Core.Application/Service/Management/UserService.cs +++ b/IRaCIS.Core.Application/Service/Management/UserService.cs @@ -754,12 +754,13 @@ namespace IRaCIS.Core.Application.Service /// /// 验证MFA 邮件 /// - /// /// /// /// - public async Task VerifyMFACodeAsync(Guid identityUserId, string Code) + public async Task VerifyMFACodeAsync(string Code) { + var identityUserId = _userInfo.IdentityUserId; + var verificationRecord = await _verificationCodeRepository.Where(t => t.UserId == identityUserId && t.Code == Code && t.CodeType == VerifyType.Email).OrderByDescending(x => x.ExpirationTime).FirstOrDefaultAsync(); VerifyEmialGetDoctorInfoOutDto result = new VerifyEmialGetDoctorInfoOutDto(); @@ -778,13 +779,9 @@ namespace IRaCIS.Core.Application.Service await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, ActionUserName = _userInfo.UserName, TargetIdentityUserId = identityUserId, OptType = UserOptType.MFALoginFail }, true); //---验证码已经过期。 throw new BusinessValidationFailedException(_localizer["TrialSiteSurvey_ExpiredVerificationCode"]); - - } else //验证码正确 并且 没有超时 { - - //删除验证码历史记录 await _verificationCodeRepository.BatchDeleteNoTrackingAsync(t => t.Id == verificationRecord.Id); await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, ActionUserName = _userInfo.UserName, TargetIdentityUserId = identityUserId, OptType = UserOptType.MFALogin }, true); diff --git a/IRaCIS.Core.Application/TestService.cs b/IRaCIS.Core.Application/TestService.cs index 1ef6753fb..40637ab18 100644 --- a/IRaCIS.Core.Application/TestService.cs +++ b/IRaCIS.Core.Application/TestService.cs @@ -167,7 +167,7 @@ namespace IRaCIS.Core.Application.Service { var userList = _userRoleRepository.Where().ToList(); - foreach (var item in userList.GroupBy(t => t.EMail.Trim())) + foreach (var item in userList.GroupBy(t => t.EMail.Trim().ToLower())) { var emailUserIdList = item.Select(t => t.Id).ToList();