Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
Vanessa 2023-01-12 16:37:05 +08:00
commit 1165f4def2
2 changed files with 7 additions and 8 deletions

View file

@ -21,7 +21,6 @@ import (
"strings"
"github.com/88250/gulu"
ginSessions "github.com/gin-contrib/sessions"
"github.com/gin-gonic/gin"
"github.com/siyuan-note/logging"
"github.com/siyuan-note/siyuan/kernel/util"
@ -39,13 +38,9 @@ func LogoutAuth(c *gin.Context) {
return
}
session := ginSessions.Default(c)
session.Options(ginSessions.Options{
Path: "/",
MaxAge: -1,
})
session.Clear()
if err := session.Save(); nil != err {
session := util.GetSession(c)
util.RemoveWorkspaceSession(session)
if err := session.Save(c); nil != err {
logging.LogErrorf("saves session failed: " + err.Error())
ret.Code = -1
ret.Msg = "save session failed"

View file

@ -80,3 +80,7 @@ func GetWorkspaceSession(session *SessionData) (ret *WorkspaceSession) {
}
return
}
func RemoveWorkspaceSession(session *SessionData) {
delete(session.Workspaces, WorkspaceDir)
}