🎨 Improve auth failed tip for browser access on non 127.0.0.1 https://github.com/siyuan-note/siyuan/issues/9224

This commit is contained in:
Daniel 2023-09-20 10:26:54 +08:00
parent 3357ff86ba
commit 752f28d699
No known key found for this signature in database
GPG key ID: 86211BA83DF03017

View file

@ -165,7 +165,7 @@ func CheckAuth(c *gin.Context) {
u, parseErr := url.Parse(origin)
if nil != parseErr {
logging.LogWarnf("parse origin [%s] failed: %s", origin, parseErr)
c.JSON(401, map[string]interface{}{"code": -1, "msg": "Auth failed"})
c.JSON(401, map[string]interface{}{"code": -1, "msg": "Auth failed: parse req header [Origin] failed"})
c.Abort()
return
@ -177,7 +177,7 @@ func CheckAuth(c *gin.Context) {
}
if !strings.HasPrefix(u.Host, util.LocalHost) && !strings.HasPrefix(u.Host, "[::1]") {
c.JSON(401, map[string]interface{}{"code": -1, "msg": "Auth failed"})
c.JSON(401, map[string]interface{}{"code": -1, "msg": "Auth failed: for security reasons, please set [Access authorization code] when using non-127.0.0.1 access\n\n为安全起见使用非 127.0.0.1 访问时请设置 [访问授权码]"})
c.Abort()
return
}