From c2446b01c50b18654b82432535047022a9750662 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=A7=E7=81=B0=E7=81=B0?= Date: Mon, 26 Aug 2024 14:51:34 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BC=98=E5=8C=96=E3=80=91=E5=90=8E?= =?UTF-8?q?=E5=8F=B0=E5=8D=95=E7=82=B9=E7=99=BB=E5=BD=95=E6=9C=89=E6=95=88?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E8=B0=83=E6=95=B4=E4=B8=BA=E6=9C=80=E9=95=BF?= =?UTF-8?q?24=E5=B0=8F=E6=97=B6=EF=BC=8C=E5=B9=B6=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E6=8C=A4=E9=80=80=E7=AD=96=E7=95=A5=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CoreCms.Net.Auth/AuthorizationSetup.cs | 14 ++------------ .../Controllers/Com/LoginController.cs | 2 +- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/CoreCms.Net.Auth/AuthorizationSetup.cs b/CoreCms.Net.Auth/AuthorizationSetup.cs index 2dad8c74..a18c2fc3 100644 --- a/CoreCms.Net.Auth/AuthorizationSetup.cs +++ b/CoreCms.Net.Auth/AuthorizationSetup.cs @@ -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 = ""; } } } diff --git a/CoreCms.Net.Web.Admin/Controllers/Com/LoginController.cs b/CoreCms.Net.Web.Admin/Controllers/Com/LoginController.cs index 9ca2ec7c..23eb662d 100644 --- a/CoreCms.Net.Web.Admin/Controllers/Com/LoginController.cs +++ b/CoreCms.Net.Web.Admin/Controllers/Com/LoginController.cs @@ -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();