Merge branch 'Test_IRC_Net8' of https://gitea.frp.extimaging.com/XCKJ/irc-netcore-api into Test_IRC_Net8
commit
96fc5ae78c
|
@ -59,7 +59,8 @@
|
||||||
|
|
||||||
"LoginMaxFailCount": 5,
|
"LoginMaxFailCount": 5,
|
||||||
|
|
||||||
"LoginFailLockMinutes": 1
|
"LoginFailLockMinutes": 1,
|
||||||
|
"AutoLoginOutMinutes": 10
|
||||||
},
|
},
|
||||||
|
|
||||||
"SystemEmailSendConfig": {
|
"SystemEmailSendConfig": {
|
||||||
|
|
|
@ -35,6 +35,8 @@ public class LimitUserRequestAuthorization : IAsyncAuthorizationFilter
|
||||||
|
|
||||||
public async Task OnAuthorizationAsync(AuthorizationFilterContext context)
|
public async Task OnAuthorizationAsync(AuthorizationFilterContext context)
|
||||||
{
|
{
|
||||||
|
var minutes = _verifyConfig.CurrentValue.AutoLoginOutMinutes;
|
||||||
|
|
||||||
if (_verifyConfig.CurrentValue.OpenLoginLimit)
|
if (_verifyConfig.CurrentValue.OpenLoginLimit)
|
||||||
{
|
{
|
||||||
if (context.ActionDescriptor.EndpointMetadata.Any(item => item is IAllowAnonymous))
|
if (context.ActionDescriptor.EndpointMetadata.Any(item => item is IAllowAnonymous))
|
||||||
|
@ -65,7 +67,7 @@ public class LimitUserRequestAuthorization : IAsyncAuthorizationFilter
|
||||||
if (string.IsNullOrWhiteSpace(cacheUserToken))
|
if (string.IsNullOrWhiteSpace(cacheUserToken))
|
||||||
{
|
{
|
||||||
//设置当前用户最新Token
|
//设置当前用户最新Token
|
||||||
await _provider.SetAsync(_userInfo.Id.ToString(), _userInfo.UserToken, TimeSpan.FromDays(7));
|
await _provider.SetAsync(_userInfo.Id.ToString(), _userInfo.UserToken, TimeSpan.FromMinutes(minutes));
|
||||||
|
|
||||||
cacheUserToken = _userInfo.UserToken;
|
cacheUserToken = _userInfo.UserToken;
|
||||||
|
|
||||||
|
@ -73,7 +75,7 @@ public class LimitUserRequestAuthorization : IAsyncAuthorizationFilter
|
||||||
//是同一个人
|
//是同一个人
|
||||||
else if (cacheUserToken == _userInfo.UserToken)
|
else if (cacheUserToken == _userInfo.UserToken)
|
||||||
{
|
{
|
||||||
|
await _provider.SetAsync(_userInfo.Id.ToString(), _userInfo.UserToken, TimeSpan.FromMinutes(minutes));
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
|
@ -21,6 +21,7 @@ namespace IRaCIS.Core.Domain.Share
|
||||||
|
|
||||||
public int LoginFailLockMinutes { get; set; }
|
public int LoginFailLockMinutes { get; set; }
|
||||||
|
|
||||||
|
public int AutoLoginOutMinutes { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class SystemEmailSendConfig
|
public class SystemEmailSendConfig
|
||||||
|
|
Loading…
Reference in New Issue