auth middleware

This commit is contained in:
Nazar Kanaev
2021-03-17 11:40:21 +00:00
parent dfb32d4ebe
commit e9f6a0a1d2
3 changed files with 73 additions and 15 deletions

View File

@@ -45,3 +45,10 @@ func (c *Context) QueryInt64(key string) (int64, error) {
query := c.Req.URL.Query()
return strconv.ParseInt(query.Get("page"), 10, 64)
}
func (c *Context) Redirect(url string) {
if url == "" {
url = "/"
}
http.Redirect(c.Out, c.Req, url, http.StatusFound)
}