@@ -825,9 +825,10 @@ namespace IRaCIS.Core.Application.Service
|
||||
/// 验证MFA 邮件
|
||||
/// </summary>
|
||||
/// <param name="Code"></param>
|
||||
/// <param name="isRemember"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="BusinessValidationFailedException"></exception>
|
||||
public async Task<IResponseOutput> VerifyMFACodeAsync(string Code)
|
||||
public async Task<IResponseOutput> VerifyMFACodeAsync(string Code, bool isRemember)
|
||||
{
|
||||
var identityUserId = _userInfo.IdentityUserId;
|
||||
|
||||
@@ -857,7 +858,12 @@ namespace IRaCIS.Core.Application.Service
|
||||
}
|
||||
}
|
||||
|
||||
await _fusionCache.SetAsync(CacheKeys.UserMFAVerifyPass(identityUserId), true, TimeSpan.FromDays(_serviceVerifyConfigConfig.UserMFAVerifyDays));
|
||||
if (isRemember)
|
||||
{
|
||||
await _fusionCache.SetAsync(CacheKeys.UserMFAVerifyPass(identityUserId), _userInfo.BrowserFingerprint, TimeSpan.FromDays(_serviceVerifyConfigConfig.UserMFAVerifyDays));
|
||||
|
||||
}
|
||||
|
||||
|
||||
return ResponseOutput.Ok();
|
||||
}
|
||||
@@ -1044,7 +1050,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
var lastLoginIPRegion = await _userLogRepository.Where(t => t.ActionUserName == actionUserName && userOptTypes.Contains(t.OptType))
|
||||
.OrderByDescending(t => t.CreateTime).Select(t => t.IPRegion).FirstOrDefaultAsync();
|
||||
|
||||
if (lastLoginIPRegion!=null&&lastLoginIPRegion != string.Empty)
|
||||
if (lastLoginIPRegion != null && lastLoginIPRegion != string.Empty)
|
||||
{
|
||||
// 与上一次区域不一致
|
||||
//if (SplitAndConcatenate(existUserLoginInfo.LastLoginIP) != SplitAndConcatenate(iPRegion))
|
||||
@@ -1122,7 +1128,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
if (_verifyConfig.CurrentValue.OpenLoginMFA)
|
||||
{
|
||||
|
||||
if ((await _fusionCache.GetOrDefaultAsync(CacheKeys.UserMFAVerifyPass(identityUserId), false)) == true)
|
||||
if ((await _fusionCache.GetOrDefaultAsync(CacheKeys.UserMFAVerifyPass(identityUserId), "")) == _userInfo.BrowserFingerprint)
|
||||
{
|
||||
userLoginReturnModel.IsMFA = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user