mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
api forbidden if login disabled.
This commit is contained in:
parent
0501091c96
commit
d00d66e0ec
@ -1,6 +1,7 @@
|
|||||||
package api
|
package api
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/go-chi/chi"
|
"github.com/go-chi/chi"
|
||||||
@ -74,7 +75,12 @@ func (api *ApiManagerCtx) Authenticate(next http.Handler) http.Handler {
|
|||||||
api.sessions.CookieClearToken(w, r)
|
api.sessions.CookieClearToken(w, r)
|
||||||
}
|
}
|
||||||
|
|
||||||
utils.HttpUnauthorized(w, err)
|
if errors.Is(err, types.ErrSessionLoginDisabled) {
|
||||||
|
utils.HttpForbidden(w, err)
|
||||||
|
} else {
|
||||||
|
utils.HttpUnauthorized(w, err)
|
||||||
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user