summaryrefslogtreecommitdiffstats
path: root/modules/auth/auth.go
diff options
context:
space:
mode:
authorUnknown <joe2010xtmf@163.com>2014-04-13 01:57:42 -0400
committerUnknown <joe2010xtmf@163.com>2014-04-13 01:57:42 -0400
commit5c2da610a2cfd3fa9666d20739e054c3588b4d05 (patch)
treeb78f9ce7181a1c204787daedf8b8224f3f77ffa1 /modules/auth/auth.go
parent33f2d33a4688cec0fc18bb38f7fae49aedc40504 (diff)
downloadgitea-5c2da610a2cfd3fa9666d20739e054c3588b4d05.tar.gz
gitea-5c2da610a2cfd3fa9666d20739e054c3588b4d05.zip
Move binding as subrepo
Diffstat (limited to 'modules/auth/auth.go')
-rw-r--r--modules/auth/auth.go22
1 files changed, 10 insertions, 12 deletions
diff --git a/modules/auth/auth.go b/modules/auth/auth.go
index 7329cbdcdf..350ef4fcbf 100644
--- a/modules/auth/auth.go
+++ b/modules/auth/auth.go
@@ -11,8 +11,6 @@ import (
"github.com/go-martini/martini"
- "github.com/gogits/binding"
-
"github.com/gogits/gogs/modules/base"
"github.com/gogits/gogs/modules/log"
)
@@ -39,7 +37,7 @@ func (f *RegisterForm) Name(field string) string {
return names[field]
}
-func (f *RegisterForm) Validate(errors *binding.Errors, req *http.Request, context martini.Context) {
+func (f *RegisterForm) Validate(errors *base.BindingErrors, req *http.Request, context martini.Context) {
if req.Method == "GET" || errors.Count() == 0 {
return
}
@@ -72,7 +70,7 @@ func (f *LogInForm) Name(field string) string {
return names[field]
}
-func (f *LogInForm) Validate(errors *binding.Errors, req *http.Request, context martini.Context) {
+func (f *LogInForm) Validate(errors *base.BindingErrors, req *http.Request, context martini.Context) {
if req.Method == "GET" || errors.Count() == 0 {
return
}
@@ -100,7 +98,7 @@ func getMinMaxSize(field reflect.StructField) string {
return ""
}
-func validate(errors *binding.Errors, data base.TmplData, form Form) {
+func validate(errors *base.BindingErrors, data base.TmplData, form Form) {
typ := reflect.TypeOf(form)
val := reflect.ValueOf(form)
@@ -121,17 +119,17 @@ func validate(errors *binding.Errors, data base.TmplData, form Form) {
if err, ok := errors.Fields[field.Name]; ok {
data["Err_"+field.Name] = true
switch err {
- case binding.RequireError:
+ case base.BindingRequireError:
data["ErrorMsg"] = form.Name(field.Name) + " cannot be empty"
- case binding.AlphaDashError:
+ case base.BindingAlphaDashError:
data["ErrorMsg"] = form.Name(field.Name) + " must be valid alpha or numeric or dash(-_) characters"
- case binding.MinSizeError:
+ case base.BindingMinSizeError:
data["ErrorMsg"] = form.Name(field.Name) + " must contain at least " + getMinMaxSize(field) + " characters"
- case binding.MaxSizeError:
+ case base.BindingMaxSizeError:
data["ErrorMsg"] = form.Name(field.Name) + " must contain at most " + getMinMaxSize(field) + " characters"
- case binding.EmailError:
+ case base.BindingEmailError:
data["ErrorMsg"] = form.Name(field.Name) + " is not a valid e-mail address"
- case binding.UrlError:
+ case base.BindingUrlError:
data["ErrorMsg"] = form.Name(field.Name) + " is not a valid URL"
default:
data["ErrorMsg"] = "Unknown error: " + err
@@ -196,7 +194,7 @@ func (f *InstallForm) Name(field string) string {
return names[field]
}
-func (f *InstallForm) Validate(errors *binding.Errors, req *http.Request, context martini.Context) {
+func (f *InstallForm) Validate(errors *base.BindingErrors, req *http.Request, context martini.Context) {
if req.Method == "GET" || errors.Count() == 0 {
return
}