aboutsummaryrefslogtreecommitdiffstats
path: root/modules/auth/auth.go
diff options
context:
space:
mode:
authorUnknown <joe2010xtmf@163.com>2014-05-05 02:42:52 -0400
committerUnknown <joe2010xtmf@163.com>2014-05-05 02:42:52 -0400
commit816c0ed5e7bba89a87689e56c19a29617f5f0ea9 (patch)
treea75a6baf4a476d0962ddf9eb76e946d568584544 /modules/auth/auth.go
parenta641854cad6dddda551a2995c765e970f7cea8ba (diff)
downloadgitea-816c0ed5e7bba89a87689e56c19a29617f5f0ea9.tar.gz
gitea-816c0ed5e7bba89a87689e56c19a29617f5f0ea9.zip
Fix import path
Diffstat (limited to 'modules/auth/auth.go')
-rw-r--r--modules/auth/auth.go23
1 files changed, 12 insertions, 11 deletions
diff --git a/modules/auth/auth.go b/modules/auth/auth.go
index 96e3868ff6..8f7deaa309 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
}