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