mirror of
http://git.coreshop.cn/jianweie/coreshoppro.git
synced 2025-12-06 20:03:26 +08:00
【优化】后台单点登录有效时间调整为最长24小时,并优化挤退策略。
This commit is contained in:
@@ -124,24 +124,14 @@ namespace CoreCms.Net.Auth
|
||||
if (string.IsNullOrEmpty(mJwt))
|
||||
{
|
||||
context.Response.Headers.Append("Token-Error-Token", "UserLoginStatusError");
|
||||
var jm = new AdminUiCallBack();
|
||||
jm.code = 401;
|
||||
jm.data = 401;
|
||||
jm.msg = "Sorry, your login information could not be found.";
|
||||
context.Response.WriteAsync(JsonConvert.SerializeObject(jm));
|
||||
return Task.CompletedTask;
|
||||
context.Token = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mJwt != token)
|
||||
{
|
||||
context.Response.Headers.Append("Token-Error-Token", "The current user logged in elsewhere");
|
||||
var jm = new AdminUiCallBack();
|
||||
jm.code = 401;
|
||||
jm.data = 401;
|
||||
jm.msg = "Sorry, your account has already been logged in elsewhere.";
|
||||
context.Response.WriteAsync(JsonConvert.SerializeObject(jm));
|
||||
return Task.CompletedTask;
|
||||
context.Token = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -141,7 +141,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
|
||||
|
||||
//缓存登录数据
|
||||
var cacheKey = $"LoginUser:{user.id}";
|
||||
ManualDataCache.Instance.Set(cacheKey, auth.token);
|
||||
ManualDataCache.Instance.Set(cacheKey, auth.token, 1440);
|
||||
|
||||
//插入登录日志
|
||||
var log = new SysLoginRecord();
|
||||
|
||||
Reference in New Issue
Block a user