chore: finalize lab7 security verification
CI / verify (pull_request) Successful in 14m53s

This commit is contained in:
2026-11-06 22:00:42 +03:00
parent 5ac64f51fa
commit a8edaf058d
53 changed files with 1130 additions and 224 deletions
+10
View File
@@ -2,7 +2,10 @@ package httpapi
import (
"encoding/json"
"errors"
"net/http"
"gitea.privcloud.tech/dizi/mtusi2026lab7/internal/password"
)
const (
@@ -40,6 +43,13 @@ func rateLimited() *apiError {
return &apiError{http.StatusTooManyRequests, errorCodeRateLimited, "too many requests"}
}
func passwordOperationError(err error) *apiError {
if errors.Is(err, password.ErrBusy) {
return rateLimited()
}
return internalError()
}
func notFound() *apiError {
return &apiError{http.StatusNotFound, errorCodeNotFound, "resource not found"}
}