mirror of
https://gitcode.com/gitea/gitea.git
synced 2025-06-01 15:55:15 +08:00
Move middlewares to web/middleware (#14480)
Co-authored-by: 6543 <6543@obermui.de>
This commit is contained in:
@ -8,7 +8,7 @@ import (
|
||||
"net/http"
|
||||
|
||||
"code.gitea.io/gitea/modules/context"
|
||||
"code.gitea.io/gitea/modules/middlewares"
|
||||
"code.gitea.io/gitea/modules/web/middleware"
|
||||
|
||||
"gitea.com/go-chi/binding"
|
||||
)
|
||||
@ -27,7 +27,7 @@ type AdminCreateUserForm struct {
|
||||
// Validate validates form fields
|
||||
func (f *AdminCreateUserForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
|
||||
ctx := context.GetContext(req)
|
||||
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
}
|
||||
|
||||
// AdminEditUserForm form for admin to create user
|
||||
@ -54,7 +54,7 @@ type AdminEditUserForm struct {
|
||||
// Validate validates form fields
|
||||
func (f *AdminEditUserForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
|
||||
ctx := context.GetContext(req)
|
||||
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
}
|
||||
|
||||
// AdminDashboardForm form for admin dashboard operations
|
||||
@ -66,5 +66,5 @@ type AdminDashboardForm struct {
|
||||
// Validate validates form fields
|
||||
func (f *AdminDashboardForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
|
||||
ctx := context.GetContext(req)
|
||||
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ import (
|
||||
"net/http"
|
||||
|
||||
"code.gitea.io/gitea/modules/context"
|
||||
"code.gitea.io/gitea/modules/middlewares"
|
||||
"code.gitea.io/gitea/modules/web/middleware"
|
||||
|
||||
"gitea.com/go-chi/binding"
|
||||
)
|
||||
@ -71,5 +71,5 @@ type AuthenticationForm struct {
|
||||
// Validate validates fields
|
||||
func (f *AuthenticationForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
|
||||
ctx := context.GetContext(req)
|
||||
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
}
|
||||
|
@ -10,8 +10,8 @@ import (
|
||||
|
||||
"code.gitea.io/gitea/models"
|
||||
"code.gitea.io/gitea/modules/context"
|
||||
"code.gitea.io/gitea/modules/middlewares"
|
||||
"code.gitea.io/gitea/modules/structs"
|
||||
"code.gitea.io/gitea/modules/web/middleware"
|
||||
|
||||
"gitea.com/go-chi/binding"
|
||||
)
|
||||
@ -33,7 +33,7 @@ type CreateOrgForm struct {
|
||||
// Validate validates the fields
|
||||
func (f *CreateOrgForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
|
||||
ctx := context.GetContext(req)
|
||||
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
}
|
||||
|
||||
// UpdateOrgSettingForm form for updating organization settings
|
||||
@ -51,7 +51,7 @@ type UpdateOrgSettingForm struct {
|
||||
// Validate validates the fields
|
||||
func (f *UpdateOrgSettingForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
|
||||
ctx := context.GetContext(req)
|
||||
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
}
|
||||
|
||||
// ___________
|
||||
@ -74,5 +74,5 @@ type CreateTeamForm struct {
|
||||
// Validate validates the fields
|
||||
func (f *CreateTeamForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
|
||||
ctx := context.GetContext(req)
|
||||
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ import (
|
||||
"net/http"
|
||||
|
||||
"code.gitea.io/gitea/modules/context"
|
||||
"code.gitea.io/gitea/modules/middlewares"
|
||||
"code.gitea.io/gitea/modules/web/middleware"
|
||||
|
||||
"gitea.com/go-chi/binding"
|
||||
)
|
||||
@ -21,5 +21,5 @@ type NewBranchForm struct {
|
||||
// Validate validates the fields
|
||||
func (f *NewBranchForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
|
||||
ctx := context.GetContext(req)
|
||||
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
}
|
||||
|
@ -13,10 +13,10 @@ import (
|
||||
"code.gitea.io/gitea/models"
|
||||
"code.gitea.io/gitea/modules/context"
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
"code.gitea.io/gitea/modules/middlewares"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
"code.gitea.io/gitea/modules/structs"
|
||||
"code.gitea.io/gitea/modules/util"
|
||||
"code.gitea.io/gitea/modules/web/middleware"
|
||||
"code.gitea.io/gitea/routers/utils"
|
||||
|
||||
"gitea.com/go-chi/binding"
|
||||
@ -56,7 +56,7 @@ type CreateRepoForm struct {
|
||||
// Validate validates the fields
|
||||
func (f *CreateRepoForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
|
||||
ctx := context.GetContext(req)
|
||||
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
}
|
||||
|
||||
// MigrateRepoForm form for migrating repository
|
||||
@ -87,7 +87,7 @@ type MigrateRepoForm struct {
|
||||
// Validate validates the fields
|
||||
func (f *MigrateRepoForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
|
||||
ctx := context.GetContext(req)
|
||||
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
}
|
||||
|
||||
// ParseRemoteAddr checks if given remote address is valid,
|
||||
@ -172,7 +172,7 @@ type RepoSettingForm struct {
|
||||
// Validate validates the fields
|
||||
func (f *RepoSettingForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
|
||||
ctx := context.GetContext(req)
|
||||
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
}
|
||||
|
||||
// __________ .__
|
||||
@ -209,7 +209,7 @@ type ProtectBranchForm struct {
|
||||
// Validate validates the fields
|
||||
func (f *ProtectBranchForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
|
||||
ctx := context.GetContext(req)
|
||||
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
}
|
||||
|
||||
// __ __ ___. .__ .__ __
|
||||
@ -271,7 +271,7 @@ type NewWebhookForm struct {
|
||||
// Validate validates the fields
|
||||
func (f *NewWebhookForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
|
||||
ctx := context.GetContext(req)
|
||||
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
}
|
||||
|
||||
// NewGogshookForm form for creating gogs hook
|
||||
@ -285,7 +285,7 @@ type NewGogshookForm struct {
|
||||
// Validate validates the fields
|
||||
func (f *NewGogshookForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
|
||||
ctx := context.GetContext(req)
|
||||
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
}
|
||||
|
||||
// NewSlackHookForm form for creating slack hook
|
||||
@ -301,7 +301,7 @@ type NewSlackHookForm struct {
|
||||
// Validate validates the fields
|
||||
func (f *NewSlackHookForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
|
||||
ctx := context.GetContext(req)
|
||||
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
}
|
||||
|
||||
// HasInvalidChannel validates the channel name is in the right format
|
||||
@ -320,7 +320,7 @@ type NewDiscordHookForm struct {
|
||||
// Validate validates the fields
|
||||
func (f *NewDiscordHookForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
|
||||
ctx := context.GetContext(req)
|
||||
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
}
|
||||
|
||||
// NewDingtalkHookForm form for creating dingtalk hook
|
||||
@ -332,7 +332,7 @@ type NewDingtalkHookForm struct {
|
||||
// Validate validates the fields
|
||||
func (f *NewDingtalkHookForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
|
||||
ctx := context.GetContext(req)
|
||||
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
}
|
||||
|
||||
// NewTelegramHookForm form for creating telegram hook
|
||||
@ -345,7 +345,7 @@ type NewTelegramHookForm struct {
|
||||
// Validate validates the fields
|
||||
func (f *NewTelegramHookForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
|
||||
ctx := context.GetContext(req)
|
||||
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
}
|
||||
|
||||
// NewMatrixHookForm form for creating Matrix hook
|
||||
@ -360,7 +360,7 @@ type NewMatrixHookForm struct {
|
||||
// Validate validates the fields
|
||||
func (f *NewMatrixHookForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
|
||||
ctx := context.GetContext(req)
|
||||
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
}
|
||||
|
||||
// NewMSTeamsHookForm form for creating MS Teams hook
|
||||
@ -372,7 +372,7 @@ type NewMSTeamsHookForm struct {
|
||||
// Validate validates the fields
|
||||
func (f *NewMSTeamsHookForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
|
||||
ctx := context.GetContext(req)
|
||||
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
}
|
||||
|
||||
// NewFeishuHookForm form for creating feishu hook
|
||||
@ -384,7 +384,7 @@ type NewFeishuHookForm struct {
|
||||
// Validate validates the fields
|
||||
func (f *NewFeishuHookForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
|
||||
ctx := context.GetContext(req)
|
||||
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
}
|
||||
|
||||
// .___
|
||||
@ -410,7 +410,7 @@ type CreateIssueForm struct {
|
||||
// Validate validates the fields
|
||||
func (f *CreateIssueForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
|
||||
ctx := context.GetContext(req)
|
||||
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
}
|
||||
|
||||
// CreateCommentForm form for creating comment
|
||||
@ -423,7 +423,7 @@ type CreateCommentForm struct {
|
||||
// Validate validates the fields
|
||||
func (f *CreateCommentForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
|
||||
ctx := context.GetContext(req)
|
||||
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
}
|
||||
|
||||
// ReactionForm form for adding and removing reaction
|
||||
@ -434,7 +434,7 @@ type ReactionForm struct {
|
||||
// Validate validates the fields
|
||||
func (f *ReactionForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
|
||||
ctx := context.GetContext(req)
|
||||
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
}
|
||||
|
||||
// IssueLockForm form for locking an issue
|
||||
@ -445,7 +445,7 @@ type IssueLockForm struct {
|
||||
// Validate validates the fields
|
||||
func (i *IssueLockForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
|
||||
ctx := context.GetContext(req)
|
||||
return middlewares.Validate(errs, ctx.Data, i, ctx.Locale)
|
||||
return middleware.Validate(errs, ctx.Data, i, ctx.Locale)
|
||||
}
|
||||
|
||||
// HasValidReason checks to make sure that the reason submitted in
|
||||
@ -510,7 +510,7 @@ type CreateMilestoneForm struct {
|
||||
// Validate validates the fields
|
||||
func (f *CreateMilestoneForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
|
||||
ctx := context.GetContext(req)
|
||||
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
}
|
||||
|
||||
// .____ ___. .__
|
||||
@ -531,7 +531,7 @@ type CreateLabelForm struct {
|
||||
// Validate validates the fields
|
||||
func (f *CreateLabelForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
|
||||
ctx := context.GetContext(req)
|
||||
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
}
|
||||
|
||||
// InitializeLabelsForm form for initializing labels
|
||||
@ -542,7 +542,7 @@ type InitializeLabelsForm struct {
|
||||
// Validate validates the fields
|
||||
func (f *InitializeLabelsForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
|
||||
ctx := context.GetContext(req)
|
||||
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
}
|
||||
|
||||
// __________ .__ .__ __________ __
|
||||
@ -566,7 +566,7 @@ type MergePullRequestForm struct {
|
||||
// Validate validates the fields
|
||||
func (f *MergePullRequestForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
|
||||
ctx := context.GetContext(req)
|
||||
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
}
|
||||
|
||||
// CodeCommentForm form for adding code comments for PRs
|
||||
@ -584,7 +584,7 @@ type CodeCommentForm struct {
|
||||
// Validate validates the fields
|
||||
func (f *CodeCommentForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
|
||||
ctx := context.GetContext(req)
|
||||
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
}
|
||||
|
||||
// SubmitReviewForm for submitting a finished code review
|
||||
@ -597,7 +597,7 @@ type SubmitReviewForm struct {
|
||||
// Validate validates the fields
|
||||
func (f *SubmitReviewForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
|
||||
ctx := context.GetContext(req)
|
||||
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
}
|
||||
|
||||
// ReviewType will return the corresponding reviewtype for type
|
||||
@ -643,7 +643,7 @@ type NewReleaseForm struct {
|
||||
// Validate validates the fields
|
||||
func (f *NewReleaseForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
|
||||
ctx := context.GetContext(req)
|
||||
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
}
|
||||
|
||||
// EditReleaseForm form for changing release
|
||||
@ -658,7 +658,7 @@ type EditReleaseForm struct {
|
||||
// Validate validates the fields
|
||||
func (f *EditReleaseForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
|
||||
ctx := context.GetContext(req)
|
||||
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
}
|
||||
|
||||
// __ __.__ __ .__
|
||||
@ -679,7 +679,7 @@ type NewWikiForm struct {
|
||||
// FIXME: use code generation to generate this method.
|
||||
func (f *NewWikiForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
|
||||
ctx := context.GetContext(req)
|
||||
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
}
|
||||
|
||||
// ___________ .___.__ __
|
||||
@ -704,7 +704,7 @@ type EditRepoFileForm struct {
|
||||
// Validate validates the fields
|
||||
func (f *EditRepoFileForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
|
||||
ctx := context.GetContext(req)
|
||||
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
}
|
||||
|
||||
// EditPreviewDiffForm form for changing preview diff
|
||||
@ -715,7 +715,7 @@ type EditPreviewDiffForm struct {
|
||||
// Validate validates the fields
|
||||
func (f *EditPreviewDiffForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
|
||||
ctx := context.GetContext(req)
|
||||
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
}
|
||||
|
||||
// ____ ___ .__ .___
|
||||
@ -740,7 +740,7 @@ type UploadRepoFileForm struct {
|
||||
// Validate validates the fields
|
||||
func (f *UploadRepoFileForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
|
||||
ctx := context.GetContext(req)
|
||||
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
}
|
||||
|
||||
// RemoveUploadFileForm form for removing uploaded file
|
||||
@ -751,7 +751,7 @@ type RemoveUploadFileForm struct {
|
||||
// Validate validates the fields
|
||||
func (f *RemoveUploadFileForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
|
||||
ctx := context.GetContext(req)
|
||||
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
}
|
||||
|
||||
// ________ .__ __
|
||||
@ -774,7 +774,7 @@ type DeleteRepoFileForm struct {
|
||||
// Validate validates the fields
|
||||
func (f *DeleteRepoFileForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
|
||||
ctx := context.GetContext(req)
|
||||
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
}
|
||||
|
||||
// ___________.__ ___________ __
|
||||
@ -793,7 +793,7 @@ type AddTimeManuallyForm struct {
|
||||
// Validate validates the fields
|
||||
func (f *AddTimeManuallyForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
|
||||
ctx := context.GetContext(req)
|
||||
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
}
|
||||
|
||||
// SaveTopicForm form for save topics for repository
|
||||
@ -809,5 +809,5 @@ type DeadlineForm struct {
|
||||
// Validate validates the fields
|
||||
func (f *DeadlineForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
|
||||
ctx := context.GetContext(req)
|
||||
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
}
|
||||
|
@ -11,8 +11,8 @@ import (
|
||||
"strings"
|
||||
|
||||
"code.gitea.io/gitea/modules/context"
|
||||
"code.gitea.io/gitea/modules/middlewares"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
"code.gitea.io/gitea/modules/web/middleware"
|
||||
|
||||
"gitea.com/go-chi/binding"
|
||||
)
|
||||
@ -69,7 +69,7 @@ type InstallForm struct {
|
||||
// Validate validates the fields
|
||||
func (f *InstallForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
|
||||
ctx := context.GetContext(req)
|
||||
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
}
|
||||
|
||||
// _____ ____ _________________ ___
|
||||
@ -92,7 +92,7 @@ type RegisterForm struct {
|
||||
// Validate validates the fields
|
||||
func (f *RegisterForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
|
||||
ctx := context.GetContext(req)
|
||||
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
}
|
||||
|
||||
// IsEmailDomainWhitelisted validates that the email address
|
||||
@ -130,7 +130,7 @@ type MustChangePasswordForm struct {
|
||||
// Validate validates the fields
|
||||
func (f *MustChangePasswordForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
|
||||
ctx := context.GetContext(req)
|
||||
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
}
|
||||
|
||||
// SignInForm form for signing in with user/password
|
||||
@ -144,7 +144,7 @@ type SignInForm struct {
|
||||
// Validate validates the fields
|
||||
func (f *SignInForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
|
||||
ctx := context.GetContext(req)
|
||||
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
}
|
||||
|
||||
// AuthorizationForm form for authorizing oauth2 clients
|
||||
@ -164,7 +164,7 @@ type AuthorizationForm struct {
|
||||
// Validate validates the fields
|
||||
func (f *AuthorizationForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
|
||||
ctx := context.GetContext(req)
|
||||
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
}
|
||||
|
||||
// GrantApplicationForm form for authorizing oauth2 clients
|
||||
@ -179,7 +179,7 @@ type GrantApplicationForm struct {
|
||||
// Validate validates the fields
|
||||
func (f *GrantApplicationForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
|
||||
ctx := context.GetContext(req)
|
||||
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
}
|
||||
|
||||
// AccessTokenForm for issuing access tokens from authorization codes or refresh tokens
|
||||
@ -198,7 +198,7 @@ type AccessTokenForm struct {
|
||||
// Validate validates the fields
|
||||
func (f *AccessTokenForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
|
||||
ctx := context.GetContext(req)
|
||||
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
}
|
||||
|
||||
// __________________________________________.___ _______ ________ _________
|
||||
@ -223,7 +223,7 @@ type UpdateProfileForm struct {
|
||||
// Validate validates the fields
|
||||
func (f *UpdateProfileForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
|
||||
ctx := context.GetContext(req)
|
||||
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
}
|
||||
|
||||
// Avatar types
|
||||
@ -243,7 +243,7 @@ type AvatarForm struct {
|
||||
// Validate validates the fields
|
||||
func (f *AvatarForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
|
||||
ctx := context.GetContext(req)
|
||||
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
}
|
||||
|
||||
// AddEmailForm form for adding new email
|
||||
@ -254,7 +254,7 @@ type AddEmailForm struct {
|
||||
// Validate validates the fields
|
||||
func (f *AddEmailForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
|
||||
ctx := context.GetContext(req)
|
||||
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
}
|
||||
|
||||
// UpdateThemeForm form for updating a users' theme
|
||||
@ -265,7 +265,7 @@ type UpdateThemeForm struct {
|
||||
// Validate validates the field
|
||||
func (f *UpdateThemeForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
|
||||
ctx := context.GetContext(req)
|
||||
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
}
|
||||
|
||||
// IsThemeExists checks if the theme is a theme available in the config.
|
||||
@ -292,7 +292,7 @@ type ChangePasswordForm struct {
|
||||
// Validate validates the fields
|
||||
func (f *ChangePasswordForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
|
||||
ctx := context.GetContext(req)
|
||||
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
}
|
||||
|
||||
// AddOpenIDForm is for changing openid uri
|
||||
@ -303,7 +303,7 @@ type AddOpenIDForm struct {
|
||||
// Validate validates the fields
|
||||
func (f *AddOpenIDForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
|
||||
ctx := context.GetContext(req)
|
||||
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
}
|
||||
|
||||
// AddKeyForm form for adding SSH/GPG key
|
||||
@ -317,7 +317,7 @@ type AddKeyForm struct {
|
||||
// Validate validates the fields
|
||||
func (f *AddKeyForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
|
||||
ctx := context.GetContext(req)
|
||||
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
}
|
||||
|
||||
// NewAccessTokenForm form for creating access token
|
||||
@ -328,7 +328,7 @@ type NewAccessTokenForm struct {
|
||||
// Validate validates the fields
|
||||
func (f *NewAccessTokenForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
|
||||
ctx := context.GetContext(req)
|
||||
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
}
|
||||
|
||||
// EditOAuth2ApplicationForm form for editing oauth2 applications
|
||||
@ -340,7 +340,7 @@ type EditOAuth2ApplicationForm struct {
|
||||
// Validate validates the fields
|
||||
func (f *EditOAuth2ApplicationForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
|
||||
ctx := context.GetContext(req)
|
||||
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
}
|
||||
|
||||
// TwoFactorAuthForm for logging in with 2FA token.
|
||||
@ -351,7 +351,7 @@ type TwoFactorAuthForm struct {
|
||||
// Validate validates the fields
|
||||
func (f *TwoFactorAuthForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
|
||||
ctx := context.GetContext(req)
|
||||
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
}
|
||||
|
||||
// TwoFactorScratchAuthForm for logging in with 2FA scratch token.
|
||||
@ -362,7 +362,7 @@ type TwoFactorScratchAuthForm struct {
|
||||
// Validate validates the fields
|
||||
func (f *TwoFactorScratchAuthForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
|
||||
ctx := context.GetContext(req)
|
||||
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
}
|
||||
|
||||
// U2FRegistrationForm for reserving an U2F name
|
||||
@ -373,7 +373,7 @@ type U2FRegistrationForm struct {
|
||||
// Validate validates the fields
|
||||
func (f *U2FRegistrationForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
|
||||
ctx := context.GetContext(req)
|
||||
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
}
|
||||
|
||||
// U2FDeleteForm for deleting U2F keys
|
||||
@ -384,5 +384,5 @@ type U2FDeleteForm struct {
|
||||
// Validate validates the fields
|
||||
func (f *U2FDeleteForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
|
||||
ctx := context.GetContext(req)
|
||||
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ import (
|
||||
"net/http"
|
||||
|
||||
"code.gitea.io/gitea/modules/context"
|
||||
"code.gitea.io/gitea/modules/middlewares"
|
||||
"code.gitea.io/gitea/modules/web/middleware"
|
||||
"gitea.com/go-chi/binding"
|
||||
)
|
||||
|
||||
@ -21,7 +21,7 @@ type SignInOpenIDForm struct {
|
||||
// Validate validates the fields
|
||||
func (f *SignInOpenIDForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
|
||||
ctx := context.GetContext(req)
|
||||
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
}
|
||||
|
||||
// SignUpOpenIDForm form for signin up with OpenID
|
||||
@ -35,7 +35,7 @@ type SignUpOpenIDForm struct {
|
||||
// Validate validates the fields
|
||||
func (f *SignUpOpenIDForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
|
||||
ctx := context.GetContext(req)
|
||||
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
}
|
||||
|
||||
// ConnectOpenIDForm form for connecting an existing account to an OpenID URI
|
||||
@ -47,5 +47,5 @@ type ConnectOpenIDForm struct {
|
||||
// Validate validates the fields
|
||||
func (f *ConnectOpenIDForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
|
||||
ctx := context.GetContext(req)
|
||||
return middlewares.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
}
|
||||
|
Reference in New Issue
Block a user