mirror of
https://github.com/go-gitea/gitea.git
synced 2026-08-29 22:00:54 +00:00
refactor: form binding validation (#38832)
Make "form-fetch-action" highlight the invalid field as "error"
This commit is contained in:
@@ -31,7 +31,7 @@ type CreateOrgForm struct {
|
||||
// Validate validates the fields
|
||||
func (f *CreateOrgForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
|
||||
ctx := context.GetValidateContext(req)
|
||||
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
return middleware.Validate(ctx, errs, f)
|
||||
}
|
||||
|
||||
// UpdateOrgSettingForm form for updating organization settings
|
||||
@@ -48,7 +48,7 @@ type UpdateOrgSettingForm struct {
|
||||
// Validate validates the fields
|
||||
func (f *UpdateOrgSettingForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
|
||||
ctx := context.GetValidateContext(req)
|
||||
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
return middleware.Validate(ctx, errs, f)
|
||||
}
|
||||
|
||||
type RenameOrgForm struct {
|
||||
@@ -76,5 +76,5 @@ type CreateTeamForm struct {
|
||||
// Validate validates the fields
|
||||
func (f *CreateTeamForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
|
||||
ctx := context.GetValidateContext(req)
|
||||
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
return middleware.Validate(ctx, errs, f)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user