diff --git a/IRaCIS.Core.Application/Service/Management/DTO/UserLogViewModel.cs b/IRaCIS.Core.Application/Service/Management/DTO/UserLogViewModel.cs index ba9937576..9f062599b 100644 --- a/IRaCIS.Core.Application/Service/Management/DTO/UserLogViewModel.cs +++ b/IRaCIS.Core.Application/Service/Management/DTO/UserLogViewModel.cs @@ -30,6 +30,13 @@ namespace IRaCIS.Core.Application.ViewModel public string IPRegion { get; set; } } + public class SendMfaCommand + { + public Guid IdentityUserId { get; set; } + + public UserMFAType MFAType { get; set; } = UserMFAType.Login; + } + ///UserLogQuery 列表查询参数模型 public class UserLogQuery : PageInput { diff --git a/IRaCIS.Core.Application/Service/Management/Interface/IUserService.cs b/IRaCIS.Core.Application/Service/Management/Interface/IUserService.cs index ff7fe8917..473297ed3 100644 --- a/IRaCIS.Core.Application/Service/Management/Interface/IUserService.cs +++ b/IRaCIS.Core.Application/Service/Management/Interface/IUserService.cs @@ -1,4 +1,5 @@ using IRaCIS.Application.Contracts; +using IRaCIS.Core.Application.ViewModel; using IRaCIS.Core.Domain.Share; namespace IRaCIS.Core.Application.Service @@ -12,7 +13,7 @@ namespace IRaCIS.Core.Application.Service Task> Login(string userName, string password); Task VerifyMFACodeAsync(string Code); - Task SendMFAEmail(Guid identityUserId, UserMFAType mfaType = 0); + Task SendMFAEmail(SendMfaCommand sendMfa); Task GetUserBasicInfo(Guid userId, string pwd); Task ModifyPassword(EditPasswordCommand editPwModel); Task ResetPassword(Guid userId); diff --git a/IRaCIS.Core.Application/Service/Management/UserService.cs b/IRaCIS.Core.Application/Service/Management/UserService.cs index c1fbb25fe..bf7441a9e 100644 --- a/IRaCIS.Core.Application/Service/Management/UserService.cs +++ b/IRaCIS.Core.Application/Service/Management/UserService.cs @@ -735,17 +735,16 @@ namespace IRaCIS.Core.Application.Service /// /// 发送MFA 验证邮件 /// - /// - /// + /// - public async Task SendMFAEmail(Guid identityUserId, UserMFAType mfaType) + public async Task SendMFAEmail(SendMfaCommand sendMfa) { - identityUserId = identityUserId == Guid.Empty ? _userInfo.IdentityUserId : identityUserId; + var identityUserId = sendMfa.IdentityUserId == Guid.Empty ? _userInfo.IdentityUserId : sendMfa.IdentityUserId; var userInfo = await _identityUserRepository.Where(u => u.Id == identityUserId).Select(t => new { t.FullName, t.EMail }).FirstOrDefaultAsync(); int verificationCode = new Random().Next(100000, 1000000); - await _mailVerificationService.SenMFAVerifyEmail(identityUserId, userInfo.FullName, userInfo.EMail, verificationCode, (UserMFAType)mfaType); + await _mailVerificationService.SenMFAVerifyEmail(identityUserId, userInfo.FullName, userInfo.EMail, verificationCode, sendMfa.MFAType); var hiddenEmail = IRCEmailPasswordHelper.MaskEmail(userInfo.EMail); return ResponseOutput.Ok(hiddenEmail); @@ -1087,7 +1086,7 @@ namespace IRaCIS.Core.Application.Service else { //正常登录才发送邮件 - await SendMFAEmail(identityUserId, UserMFAType.Login); + await SendMFAEmail(new SendMfaCommand() { IdentityUserId = identityUserId, MFAType = UserMFAType.Login }); }