diff --git a/routers/api/v1/repo/license_key.go b/routers/api/v1/repo/license_key.go index 50da14d4f8..5fcd734616 100644 --- a/routers/api/v1/repo/license_key.go +++ b/routers/api/v1/repo/license_key.go @@ -10,6 +10,7 @@ import ( "git.mokoconsulting.tech/MokoConsulting/MokoGitea/models/licenses" "git.mokoconsulting.tech/MokoConsulting/MokoGitea/modules/structs" "git.mokoconsulting.tech/MokoConsulting/MokoGitea/modules/timeutil" + "git.mokoconsulting.tech/MokoConsulting/MokoGitea/modules/web" "git.mokoconsulting.tech/MokoConsulting/MokoGitea/services/context" ) @@ -71,11 +72,7 @@ func ListLicensePackages(ctx *context.APIContext) { // CreateLicensePackage creates a new license package. func CreateLicensePackage(ctx *context.APIContext) { - form := &structs.CreateLicensePackageOption{} - if err := ctx.Bind(form); err != nil { - ctx.APIErrorValidation(err) - return - } + form := web.GetForm(ctx).(*structs.CreateLicensePackageOption) pkg := &licenses.LicensePackage{ OwnerID: ctx.Repo.Repository.OwnerID, @@ -115,11 +112,7 @@ func ListLicenseKeys(ctx *context.APIContext) { // CreateLicenseKey creates a new license key. func CreateLicenseKey(ctx *context.APIContext) { - form := &structs.CreateLicenseKeyOption{} - if err := ctx.Bind(form); err != nil { - ctx.APIErrorValidation(err) - return - } + form := web.GetForm(ctx).(*structs.CreateLicenseKeyOption) key := &licenses.LicenseKey{ PackageID: form.PackageID,