diff options
Diffstat (limited to 'modules/auth')
-rw-r--r-- | modules/auth/admin.go | 3 | ||||
-rw-r--r-- | modules/auth/auth.go | 23 | ||||
-rw-r--r-- | modules/auth/issue.go | 3 | ||||
-rw-r--r-- | modules/auth/release.go | 3 | ||||
-rw-r--r-- | modules/auth/repo.go | 5 | ||||
-rw-r--r-- | modules/auth/setting.go | 3 | ||||
-rw-r--r-- | modules/auth/user.go | 5 |
7 files changed, 26 insertions, 19 deletions
diff --git a/modules/auth/admin.go b/modules/auth/admin.go index 877af19a..51c1b78c 100644 --- a/modules/auth/admin.go +++ b/modules/auth/admin.go @@ -12,6 +12,7 @@ import ( "github.com/gogits/gogs/modules/base" "github.com/gogits/gogs/modules/log" + "github.com/gogits/gogs/modules/middleware/binding" ) type AdminEditUserForm struct { @@ -33,7 +34,7 @@ func (f *AdminEditUserForm) Name(field string) string { return names[field] } -func (f *AdminEditUserForm) Validate(errors *base.BindingErrors, req *http.Request, context martini.Context) { +func (f *AdminEditUserForm) Validate(errors *binding.BindingErrors, req *http.Request, context martini.Context) { if req.Method == "GET" || errors.Count() == 0 { return } diff --git a/modules/auth/auth.go b/modules/auth/auth.go index 96e3868f..8f7deaa3 100644 --- a/modules/auth/auth.go +++ b/modules/auth/auth.go @@ -13,6 +13,7 @@ import ( "github.com/gogits/gogs/modules/base" "github.com/gogits/gogs/modules/log" + "github.com/gogits/gogs/modules/middleware/binding" ) // Web form interface. @@ -37,7 +38,7 @@ func (f *RegisterForm) Name(field string) string { return names[field] } -func (f *RegisterForm) Validate(errors *base.BindingErrors, req *http.Request, context martini.Context) { +func (f *RegisterForm) Validate(errors *binding.BindingErrors, req *http.Request, context martini.Context) { if req.Method == "GET" || errors.Count() == 0 { return } @@ -70,7 +71,7 @@ func (f *LogInForm) Name(field string) string { return names[field] } -func (f *LogInForm) Validate(errors *base.BindingErrors, req *http.Request, context martini.Context) { +func (f *LogInForm) Validate(errors *binding.BindingErrors, req *http.Request, context martini.Context) { if req.Method == "GET" || errors.Count() == 0 { return } @@ -98,7 +99,7 @@ func getMinMaxSize(field reflect.StructField) string { return "" } -func validate(errors *base.BindingErrors, data base.TmplData, form Form) { +func validate(errors *binding.BindingErrors, data base.TmplData, form Form) { typ := reflect.TypeOf(form) val := reflect.ValueOf(form) @@ -119,19 +120,19 @@ func validate(errors *base.BindingErrors, data base.TmplData, form Form) { if err, ok := errors.Fields[field.Name]; ok { data["Err_"+field.Name] = true switch err { - case base.BindingRequireError: + case binding.BindingRequireError: data["ErrorMsg"] = form.Name(field.Name) + " cannot be empty" - case base.BindingAlphaDashError: + case binding.BindingAlphaDashError: data["ErrorMsg"] = form.Name(field.Name) + " must be valid alpha or numeric or dash(-_) characters" - case base.BindingAlphaDashDotError: + case binding.BindingAlphaDashDotError: data["ErrorMsg"] = form.Name(field.Name) + " must be valid alpha or numeric or dash(-_) or dot characters" - case base.BindingMinSizeError: + case binding.BindingMinSizeError: data["ErrorMsg"] = form.Name(field.Name) + " must contain at least " + getMinMaxSize(field) + " characters" - case base.BindingMaxSizeError: + case binding.BindingMaxSizeError: data["ErrorMsg"] = form.Name(field.Name) + " must contain at most " + getMinMaxSize(field) + " characters" - case base.BindingEmailError: + case binding.BindingEmailError: data["ErrorMsg"] = form.Name(field.Name) + " is not a valid e-mail address" - case base.BindingUrlError: + case binding.BindingUrlError: data["ErrorMsg"] = form.Name(field.Name) + " is not a valid URL" default: data["ErrorMsg"] = "Unknown error: " + err @@ -196,7 +197,7 @@ func (f *InstallForm) Name(field string) string { return names[field] } -func (f *InstallForm) Validate(errors *base.BindingErrors, req *http.Request, context martini.Context) { +func (f *InstallForm) Validate(errors *binding.BindingErrors, req *http.Request, context martini.Context) { if req.Method == "GET" || errors.Count() == 0 { return } diff --git a/modules/auth/issue.go b/modules/auth/issue.go index f73ddc74..85be12d2 100644 --- a/modules/auth/issue.go +++ b/modules/auth/issue.go @@ -12,6 +12,7 @@ import ( "github.com/gogits/gogs/modules/base" "github.com/gogits/gogs/modules/log" + "github.com/gogits/gogs/modules/middleware/binding" ) type CreateIssueForm struct { @@ -29,7 +30,7 @@ func (f *CreateIssueForm) Name(field string) string { return names[field] } -func (f *CreateIssueForm) Validate(errors *base.BindingErrors, req *http.Request, context martini.Context) { +func (f *CreateIssueForm) Validate(errors *binding.BindingErrors, req *http.Request, context martini.Context) { if req.Method == "GET" || errors.Count() == 0 { return } diff --git a/modules/auth/release.go b/modules/auth/release.go index a29028e0..9855c303 100644 --- a/modules/auth/release.go +++ b/modules/auth/release.go @@ -12,6 +12,7 @@ import ( "github.com/gogits/gogs/modules/base" "github.com/gogits/gogs/modules/log" + "github.com/gogits/gogs/modules/middleware/binding" ) type NewReleaseForm struct { @@ -30,7 +31,7 @@ func (f *NewReleaseForm) Name(field string) string { return names[field] } -func (f *NewReleaseForm) Validate(errors *base.BindingErrors, req *http.Request, context martini.Context) { +func (f *NewReleaseForm) Validate(errors *binding.BindingErrors, req *http.Request, context martini.Context) { if req.Method == "GET" || errors.Count() == 0 { return } diff --git a/modules/auth/repo.go b/modules/auth/repo.go index f67fbf67..e61e8202 100644 --- a/modules/auth/repo.go +++ b/modules/auth/repo.go @@ -12,6 +12,7 @@ import ( "github.com/gogits/gogs/modules/base" "github.com/gogits/gogs/modules/log" + "github.com/gogits/gogs/modules/middleware/binding" ) type CreateRepoForm struct { @@ -31,7 +32,7 @@ func (f *CreateRepoForm) Name(field string) string { return names[field] } -func (f *CreateRepoForm) Validate(errors *base.BindingErrors, req *http.Request, context martini.Context) { +func (f *CreateRepoForm) Validate(errors *binding.BindingErrors, req *http.Request, context martini.Context) { if req.Method == "GET" || errors.Count() == 0 { return } @@ -69,7 +70,7 @@ func (f *MigrateRepoForm) Name(field string) string { return names[field] } -func (f *MigrateRepoForm) Validate(errors *base.BindingErrors, req *http.Request, context martini.Context) { +func (f *MigrateRepoForm) Validate(errors *binding.BindingErrors, req *http.Request, context martini.Context) { if req.Method == "GET" || errors.Count() == 0 { return } diff --git a/modules/auth/setting.go b/modules/auth/setting.go index 7cee00de..3316d7b9 100644 --- a/modules/auth/setting.go +++ b/modules/auth/setting.go @@ -13,6 +13,7 @@ import ( "github.com/gogits/gogs/modules/base" "github.com/gogits/gogs/modules/log" + "github.com/gogits/gogs/modules/middleware/binding" ) type AddSSHKeyForm struct { @@ -28,7 +29,7 @@ func (f *AddSSHKeyForm) Name(field string) string { return names[field] } -func (f *AddSSHKeyForm) Validate(errors *base.BindingErrors, req *http.Request, context martini.Context) { +func (f *AddSSHKeyForm) Validate(errors *binding.BindingErrors, req *http.Request, context martini.Context) { data := context.Get(reflect.TypeOf(base.TmplData{})).Interface().(base.TmplData) AssignForm(f, data) diff --git a/modules/auth/user.go b/modules/auth/user.go index 8d60670d..0e591398 100644 --- a/modules/auth/user.go +++ b/modules/auth/user.go @@ -15,6 +15,7 @@ import ( "github.com/gogits/gogs/models" "github.com/gogits/gogs/modules/base" "github.com/gogits/gogs/modules/log" + "github.com/gogits/gogs/modules/middleware/binding" ) // SignedInId returns the id of signed in user. @@ -93,7 +94,7 @@ func (f *UpdateProfileForm) Name(field string) string { return names[field] } -func (f *UpdateProfileForm) Validate(errors *base.BindingErrors, req *http.Request, context martini.Context) { +func (f *UpdateProfileForm) Validate(errors *binding.BindingErrors, req *http.Request, context martini.Context) { if req.Method == "GET" || errors.Count() == 0 { return } @@ -126,7 +127,7 @@ func (f *UpdatePasswdForm) Name(field string) string { return names[field] } -func (f *UpdatePasswdForm) Validate(errors *base.BindingErrors, req *http.Request, context martini.Context) { +func (f *UpdatePasswdForm) Validate(errors *binding.BindingErrors, req *http.Request, context martini.Context) { if req.Method == "GET" || errors.Count() == 0 { return } |