mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 14:40:12 +01:00
🎨 改进多工作空间鉴权
This commit is contained in:
parent
59bd919b0c
commit
4e9e111ee7
4 changed files with 33 additions and 11 deletions
|
|
@ -364,13 +364,14 @@ func serveWebSocket(ginServer *gin.Engine) {
|
|||
if nil == val {
|
||||
authOk = false
|
||||
} else {
|
||||
sess := map[string]interface{}{}
|
||||
err = gulu.JSON.UnmarshalJSON([]byte(val.(string)), &sess)
|
||||
sess := &util.SessionData{}
|
||||
err = gulu.JSON.UnmarshalJSON([]byte(val.(string)), sess)
|
||||
if nil != err {
|
||||
authOk = false
|
||||
logging.LogErrorf("unmarshal cookie failed: %s", err)
|
||||
} else {
|
||||
authOk = sess["AccessAuthCode"].(string) == model.Conf.AccessAuthCode
|
||||
workspaceSess := util.GetWorkspaceSession(sess)
|
||||
authOk = workspaceSess.AccessAuthCode == model.Conf.AccessAuthCode
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue