From a11d205c88ca9fd05922bbd430b5dcd0f4190384 Mon Sep 17 00:00:00 2001 From: GoEdgeLab Date: Fri, 21 Apr 2023 15:39:51 +0800 Subject: [PATCH] =?UTF-8?q?SESSION=E8=AF=BB=E5=8F=96=E5=A4=B1=E8=B4=A5?= =?UTF-8?q?=E6=97=B6=E4=B8=8D=E5=BC=BA=E5=88=B6=E9=87=8D=E6=96=B0=E7=99=BB?= =?UTF-8?q?=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/nodes/session_manager.go | 1 + internal/web/helpers/user_must_auth.go | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/internal/nodes/session_manager.go b/internal/nodes/session_manager.go index 4eaa5bc5..9cad35d8 100644 --- a/internal/nodes/session_manager.go +++ b/internal/nodes/session_manager.go @@ -40,6 +40,7 @@ func (this *SessionManager) Read(sid string) map[string]string { resp, err := rpcClient.LoginSessionRPC().FindLoginSession(rpcClient.Context(0), &pb.FindLoginSessionRequest{Sid: sid}) if err != nil { logs.Println("SESSION", "read '"+sid+"' failed: "+err.Error()) + result["@error"] = err.Error() return result } diff --git a/internal/web/helpers/user_must_auth.go b/internal/web/helpers/user_must_auth.go index 39d787e3..b66c9933 100644 --- a/internal/web/helpers/user_must_auth.go +++ b/internal/web/helpers/user_must_auth.go @@ -170,6 +170,11 @@ func (this *userMustAuth) BeforeAction(actionPtr actions.ActionWrapper, paramNam var adminId = session.GetInt64("adminId") if adminId <= 0 { + var errString = session.GetString("@error") + if len(errString) > 0 { + action.WriteString("read session failed: " + errString) + return false + } this.login(action) return false }