Skip to content

Commit

Permalink
perf: 优化opvn的login & history接口认证逻辑
Browse files Browse the repository at this point in the history
  • Loading branch information
GavinTan committed Jan 13, 2025
1 parent db71647 commit 396d0db
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,13 @@ func AuthMiddleWare() gin.HandlerFunc {
session := sessions.Default(c)
user := session.Get("user")

if c.Request.URL.Path == "/ovpn/login" || c.Request.URL.Path == "/ovpn/history" {
if strings.Contains(c.Request.Host, "127.0.0.1") {
c.Next()
return
}
}

if user == nil {
c.Redirect(302, "/login")
c.Abort()
Expand Down

0 comments on commit 396d0db

Please sign in to comment.