api: updated response message on invalid credential, add auth check endpoint

This commit is contained in:
yusing
2025-01-20 02:14:21 +08:00
parent fb0dc7dea0
commit bcc7faa8e5
2 changed files with 10 additions and 3 deletions

View File

@@ -115,7 +115,8 @@ func (auth *UserPassAuth) LoginCallbackHandler(w http.ResponseWriter, r *http.Re
return
}
if err := auth.validatePassword(creds.User, creds.Pass); err != nil {
U.HandleErr(w, r, err, http.StatusUnauthorized)
U.LogError(r).Err(err).Msg("auth: invalid credentials")
U.RespondError(w, E.New("invalid credentials"), http.StatusUnauthorized)
return
}
token, err := auth.NewToken()