mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 14:40:12 +01:00
🐛 多开工作空间 锁屏 后访问鉴权失败 https://github.com/siyuan-note/siyuan/issues/7038
This commit is contained in:
parent
aaec2300a9
commit
aee282539a
2 changed files with 8 additions and 9 deletions
|
|
@ -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,19 +38,15 @@ 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"
|
||||
}
|
||||
|
||||
util.ReloadUI()
|
||||
//util.ReloadUI()
|
||||
}
|
||||
|
||||
func LoginAuth(c *gin.Context) {
|
||||
|
|
|
|||
|
|
@ -80,3 +80,7 @@ func GetWorkspaceSession(session *SessionData) (ret *WorkspaceSession) {
|
|||
}
|
||||
return
|
||||
}
|
||||
|
||||
func RemoveWorkspaceSession(session *SessionData) {
|
||||
delete(session.Workspaces, WorkspaceDir)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue