🎨 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:
parent
3357ff86ba
commit
752f28d699
1 changed files with 2 additions and 2 deletions
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue