auth middleware basepath tweaks

This commit is contained in:
Nazar Kanaev 2021-03-17 11:54:58 +00:00
parent e9f6a0a1d2
commit 73b7144394
2 changed files with 2 additions and 7 deletions

View file

@ -17,11 +17,6 @@ type authMiddleware struct {
}
func (m *authMiddleware) handler(c *router.Context) {
basepath := m.basepath
if basepath == "" {
basepath = "/"
}
if strings.HasPrefix(c.Req.URL.Path, m.public) {
c.Next()
return
@ -31,7 +26,7 @@ func (m *authMiddleware) handler(c *router.Context) {
return
}
if c.Req.URL.Path != basepath {
if c.Req.URL.Path != m.basepath {
// TODO: check ajax
c.Out.WriteHeader(http.StatusForbidden)
return