returns add to PageValidationMiddleware
parent
7ed1999804
commit
590a9e020a
|
@ -65,11 +65,13 @@ func PageValidationMiddleware(s *models.Site) gin.HandlerFunc {
|
|||
if pageNumber > len(s.Posts) || pageNumber < 1 {
|
||||
c.Redirect(http.StatusFound, "/index/1?Нет доступа")
|
||||
c.Abort()
|
||||
return
|
||||
}
|
||||
case "index", "AJAXindex":
|
||||
if pageNumber > s.Posts.GetMaxPageNumber() || pageNumber < 1 {
|
||||
c.Redirect(http.StatusFound, "/index/1?Нет доступа")
|
||||
c.Abort()
|
||||
return
|
||||
}
|
||||
case "search", "AJAXsearch":
|
||||
searchSubstring := c.Query("search")
|
||||
|
@ -79,11 +81,13 @@ func PageValidationMiddleware(s *models.Site) gin.HandlerFunc {
|
|||
|
||||
c.Redirect(http.StatusFound, "/index/1?Нет доступа")
|
||||
c.Abort()
|
||||
return
|
||||
}
|
||||
default:
|
||||
if pageNumber != 1 {
|
||||
c.Redirect(http.StatusFound, "/index/1?Нет доступа")
|
||||
c.Abort()
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue