mirror of
https://github.com/miniflux/v2.git
synced 2025-06-27 16:36:00 +00:00
Improve user API responses
This commit is contained in:
parent
7c19febd73
commit
0f053b07a5
3 changed files with 51 additions and 63 deletions
|
@ -39,7 +39,14 @@ func (b *BasicAuthMiddleware) Handler(next http.Handler) http.Handler {
|
|||
}
|
||||
|
||||
user, err := b.store.UserByUsername(username)
|
||||
if err != nil || user == nil {
|
||||
if err != nil {
|
||||
logger.Error("[Middleware:BasicAuth] %v", err)
|
||||
w.WriteHeader(http.StatusInternalServerError)
|
||||
w.Write([]byte(errorResponse))
|
||||
return
|
||||
}
|
||||
|
||||
if user == nil {
|
||||
logger.Info("[Middleware:BasicAuth] User not found: %s", username)
|
||||
w.WriteHeader(http.StatusUnauthorized)
|
||||
w.Write([]byte(errorResponse))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue