mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-12 19:30:26 +08:00
SESSION读取失败时不强制重新登录
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user