Explorar o código

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

Daniel hai 1 ano
pai
achega
752f28d699
Modificáronse 1 ficheiros con 2 adicións e 2 borrados
  1. 2 2
      kernel/model/session.go

+ 2 - 2
kernel/model/session.go

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