add limit for local call

This commit is contained in:
Ulric Qin 2021-09-04 19:45:38 +08:00
parent 086dcad81f
commit c63987d726
1 changed files with 1 additions and 1 deletions

View File

@ -233,7 +233,7 @@ func loginUsername(c *gin.Context) string {
ip = remoteAddr[0:idx]
}
if ip == "127.0.0.1" {
if (ip == "127.0.0.1" || ip == "[::1]") && c.GetHeader("X-Local") == "1" {
//本地调用都当成是root用户在调用
username = "root"
}