修改mfa 登录
continuous-integration/drone/push Build is running
Details
continuous-integration/drone/push Build is running
Details
parent
a0b18bbf72
commit
2ac7af44b9
|
@ -30,6 +30,13 @@ namespace IRaCIS.Core.Application.ViewModel
|
||||||
public string IPRegion { get; set; }
|
public string IPRegion { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class SendMfaCommand
|
||||||
|
{
|
||||||
|
public Guid IdentityUserId { get; set; }
|
||||||
|
|
||||||
|
public UserMFAType MFAType { get; set; } = UserMFAType.Login;
|
||||||
|
}
|
||||||
|
|
||||||
///<summary>UserLogQuery 列表查询参数模型</summary>
|
///<summary>UserLogQuery 列表查询参数模型</summary>
|
||||||
public class UserLogQuery : PageInput
|
public class UserLogQuery : PageInput
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using IRaCIS.Application.Contracts;
|
using IRaCIS.Application.Contracts;
|
||||||
|
using IRaCIS.Core.Application.ViewModel;
|
||||||
using IRaCIS.Core.Domain.Share;
|
using IRaCIS.Core.Domain.Share;
|
||||||
|
|
||||||
namespace IRaCIS.Core.Application.Service
|
namespace IRaCIS.Core.Application.Service
|
||||||
|
@ -12,7 +13,7 @@ namespace IRaCIS.Core.Application.Service
|
||||||
Task<IResponseOutput<LoginReturnDTO>> Login(string userName, string password);
|
Task<IResponseOutput<LoginReturnDTO>> Login(string userName, string password);
|
||||||
Task<IResponseOutput> VerifyMFACodeAsync(string Code);
|
Task<IResponseOutput> VerifyMFACodeAsync(string Code);
|
||||||
|
|
||||||
Task<IResponseOutput> SendMFAEmail(Guid identityUserId, UserMFAType mfaType = 0);
|
Task<IResponseOutput> SendMFAEmail(SendMfaCommand sendMfa);
|
||||||
Task<UserBasicInfo> GetUserBasicInfo(Guid userId, string pwd);
|
Task<UserBasicInfo> GetUserBasicInfo(Guid userId, string pwd);
|
||||||
Task<IResponseOutput> ModifyPassword(EditPasswordCommand editPwModel);
|
Task<IResponseOutput> ModifyPassword(EditPasswordCommand editPwModel);
|
||||||
Task<IResponseOutput> ResetPassword(Guid userId);
|
Task<IResponseOutput> ResetPassword(Guid userId);
|
||||||
|
|
|
@ -735,17 +735,16 @@ namespace IRaCIS.Core.Application.Service
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 发送MFA 验证邮件
|
/// 发送MFA 验证邮件
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="identityUserId"></param>
|
|
||||||
/// <param name="mfaType"></param>
|
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<IResponseOutput> SendMFAEmail(Guid identityUserId, UserMFAType mfaType)
|
public async Task<IResponseOutput> 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();
|
var userInfo = await _identityUserRepository.Where(u => u.Id == identityUserId).Select(t => new { t.FullName, t.EMail }).FirstOrDefaultAsync();
|
||||||
|
|
||||||
int verificationCode = new Random().Next(100000, 1000000);
|
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);
|
var hiddenEmail = IRCEmailPasswordHelper.MaskEmail(userInfo.EMail);
|
||||||
return ResponseOutput.Ok(hiddenEmail);
|
return ResponseOutput.Ok(hiddenEmail);
|
||||||
|
@ -1087,7 +1086,7 @@ namespace IRaCIS.Core.Application.Service
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//正常登录才发送邮件
|
//正常登录才发送邮件
|
||||||
await SendMFAEmail(identityUserId, UserMFAType.Login);
|
await SendMFAEmail(new SendMfaCommand() { IdentityUserId = identityUserId, MFAType = UserMFAType.Login });
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue