Skip to content

Commit

Permalink
update api validation
Browse files Browse the repository at this point in the history
  • Loading branch information
pascal-fischer committed Oct 24, 2024
1 parent 4d65752 commit f392043
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions management/server/http/setupkeys_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,8 @@ func (h *SetupKeysHandler) CreateSetupKey(w http.ResponseWriter, r *http.Request

expiresIn := time.Duration(req.ExpiresIn) * time.Second

day := time.Hour * 24
if expiresIn < day || expiresIn == 0 {
util.WriteError(r.Context(), status.Errorf(status.InvalidArgument, "expiresIn should be at least 1 day"), w)
if expiresIn < 0 {
util.WriteError(r.Context(), status.Errorf(status.InvalidArgument, "expiresIn can not be in the past"), w)
return
}

Expand Down

0 comments on commit f392043

Please sign in to comment.