diff options
author | Unknown <joe2010xtmf@163.com> | 2014-05-05 13:08:01 -0400 |
---|---|---|
committer | Unknown <joe2010xtmf@163.com> | 2014-05-05 13:08:01 -0400 |
commit | c1eb4d894a092aed1b87ddf5f80ee824fd56789d (patch) | |
tree | b58beee7c762cbbb1cec524c16471788820609b6 /modules/auth/auth.go | |
parent | 5f653898f3b39669ce9dbf0ee2263c391695019d (diff) | |
download | gitea-c1eb4d894a092aed1b87ddf5f80ee824fd56789d.tar.gz gitea-c1eb4d894a092aed1b87ddf5f80ee824fd56789d.zip |
Clean api code
Diffstat (limited to 'modules/auth/auth.go')
-rw-r--r-- | modules/auth/auth.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/modules/auth/auth.go b/modules/auth/auth.go index 2f77349177..62728acceb 100644 --- a/modules/auth/auth.go +++ b/modules/auth/auth.go @@ -91,7 +91,7 @@ func (f *LogInForm) Validate(errors *binding.BindingErrors, req *http.Request, c validate(errors, data, f) } -func getMinMaxSize(field reflect.StructField) string { +func GetMinMaxSize(field reflect.StructField) string { for _, rule := range strings.Split(field.Tag.Get("binding"), ";") { if strings.HasPrefix(rule, "MinSize(") || strings.HasPrefix(rule, "MaxSize(") { return rule[8 : len(rule)-1] @@ -128,9 +128,9 @@ func validate(errors *binding.BindingErrors, data base.TmplData, form Form) { case binding.BindingAlphaDashDotError: data["ErrorMsg"] = form.Name(field.Name) + " must be valid alpha or numeric or dash(-_) or dot characters" case binding.BindingMinSizeError: - data["ErrorMsg"] = form.Name(field.Name) + " must contain at least " + getMinMaxSize(field) + " characters" + data["ErrorMsg"] = form.Name(field.Name) + " must contain at least " + GetMinMaxSize(field) + " characters" case binding.BindingMaxSizeError: - data["ErrorMsg"] = form.Name(field.Name) + " must contain at most " + getMinMaxSize(field) + " characters" + data["ErrorMsg"] = form.Name(field.Name) + " must contain at most " + GetMinMaxSize(field) + " characters" case binding.BindingEmailError: data["ErrorMsg"] = form.Name(field.Name) + " is not a valid e-mail address" case binding.BindingUrlError: |