mirror of
https://github.com/m1k1o/neko.git
synced 2025-05-30 17:37:16 +02:00
api forbidden if login disabled.
This commit is contained in:
parent
0501091c96
commit
d00d66e0ec
1 changed files with 7 additions and 1 deletions
|
@ -1,6 +1,7 @@
|
|||
package api
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"net/http"
|
||||
|
||||
"github.com/go-chi/chi"
|
||||
|
@ -74,7 +75,12 @@ func (api *ApiManagerCtx) Authenticate(next http.Handler) http.Handler {
|
|||
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
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue