fix: address lab2 review feedback

This commit is contained in:
Fedoroff
2026-10-27 20:03:08 +03:00
parent c251f2cb7d
commit f08011385a
11 changed files with 280 additions and 82 deletions
+1 -5
View File
@@ -4,7 +4,6 @@ import (
"crypto/rand"
"crypto/subtle"
"encoding/base64"
"encoding/json"
"errors"
"net/http"
"regexp"
@@ -87,10 +86,7 @@ func VerifyPassword(password, encoded string) bool {
func (h *UserHandler) Create(w http.ResponseWriter, r *http.Request) {
var req createUserRequest
decoder := json.NewDecoder(r.Body)
decoder.DisallowUnknownFields()
if err := decoder.Decode(&req); err != nil {
if err := decodeOneObject(r, &req); err != nil {
writeError(w, r, http.StatusBadRequest,
"invalid_request", "invalid request body")
return