安全入口特殊路由跳过重定向

pull/79/head^2
zhangchenhao 2025-05-08 16:11:14 +08:00
parent 28dfd41249
commit a89e77f559
1 changed files with 3 additions and 0 deletions

View File

@ -36,6 +36,9 @@ func SessionAuthMiddleware() gin.HandlerFunc {
// 一定要保存 session BEFORE redirect // 一定要保存 session BEFORE redirect
session.Save() session.Save()
} }
if paths[0] == "login" || paths[0] == "home" {
return
}
// 返回登录页 // 返回登录页
c.Redirect(http.StatusFound, "/login") c.Redirect(http.StatusFound, "/login")
// c.Abort() // c.Abort()