🎨 改进多工作空间鉴权

This commit is contained in:
Liang Ding 2023-01-10 22:25:02 +08:00
parent 59bd919b0c
commit 4e9e111ee7
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
4 changed files with 33 additions and 11 deletions

View file

@ -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
}
}
}