diff options
author | Unknwon <joe2010xtmf@163.com> | 2014-12-15 01:49:59 -0500 |
---|---|---|
committer | Unknwon <joe2010xtmf@163.com> | 2014-12-15 01:49:59 -0500 |
commit | 9803c421f56771805a9d63280a0c830f6db3b13b (patch) | |
tree | 68fdd6d6270d65c77f239cfc3d1e2eac5df33692 /modules | |
parent | 792ec63c8a9256734c51ba9b846e5da0030b67e1 (diff) | |
download | gitea-9803c421f56771805a9d63280a0c830f6db3b13b.tar.gz gitea-9803c421f56771805a9d63280a0c830f6db3b13b.zip |
fix binding api broken
Diffstat (limited to 'modules')
-rw-r--r-- | modules/auth/apiv1/miscellaneous.go | 14 | ||||
-rw-r--r-- | modules/auth/auth.go | 14 |
2 files changed, 14 insertions, 14 deletions
diff --git a/modules/auth/apiv1/miscellaneous.go b/modules/auth/apiv1/miscellaneous.go index d470ff0e45..4e7570051e 100644 --- a/modules/auth/apiv1/miscellaneous.go +++ b/modules/auth/apiv1/miscellaneous.go @@ -49,19 +49,19 @@ func validateApiReq(errs binding.Errors, data map[string]interface{}, f auth.For if errs[0].FieldNames[0] == field.Name { switch errs[0].Classification { - case binding.RequiredError: + case binding.ERR_REQUIRED: data["ErrorMsg"] = fieldName + " cannot be empty" - case binding.AlphaDashError: + case binding.ERR_ALPHA_DASH: data["ErrorMsg"] = fieldName + " must be valid alpha or numeric or dash(-_) characters" - case binding.AlphaDashDotError: + case binding.ERR_ALPHA_DASH_DOT: data["ErrorMsg"] = fieldName + " must be valid alpha or numeric or dash(-_) or dot characters" - case binding.MinSizeError: + case binding.ERR_MIN_SIZE: data["ErrorMsg"] = fieldName + " must contain at least " + auth.GetMinSize(field) + " characters" - case binding.MaxSizeError: + case binding.ERR_MAX_SIZE: data["ErrorMsg"] = fieldName + " must contain at most " + auth.GetMaxSize(field) + " characters" - case binding.EmailError: + case binding.ERR_EMAIL: data["ErrorMsg"] = fieldName + " is not a valid e-mail address" - case binding.UrlError: + case binding.ERR_URL: data["ErrorMsg"] = fieldName + " is not a valid URL" default: data["ErrorMsg"] = "Unknown error: " + errs[0].Classification diff --git a/modules/auth/auth.go b/modules/auth/auth.go index acf4bf02ef..1dd96d8d40 100644 --- a/modules/auth/auth.go +++ b/modules/auth/auth.go @@ -204,19 +204,19 @@ func validate(errs binding.Errors, data map[string]interface{}, f Form, l macaro data["Err_"+field.Name] = true trName := l.Tr("form." + field.Name) switch errs[0].Classification { - case binding.RequiredError: + case binding.ERR_REQUIRED: data["ErrorMsg"] = trName + l.Tr("form.require_error") - case binding.AlphaDashError: + case binding.ERR_ALPHA_DASH: data["ErrorMsg"] = trName + l.Tr("form.alpha_dash_error") - case binding.AlphaDashDotError: + case binding.ERR_ALPHA_DASH_DOT: data["ErrorMsg"] = trName + l.Tr("form.alpha_dash_dot_error") - case binding.MinSizeError: + case binding.ERR_MIN_SIZE: data["ErrorMsg"] = trName + l.Tr("form.min_size_error", GetMinSize(field)) - case binding.MaxSizeError: + case binding.ERR_MAX_SIZE: data["ErrorMsg"] = trName + l.Tr("form.max_size_error", GetMaxSize(field)) - case binding.EmailError: + case binding.ERR_EMAIL: data["ErrorMsg"] = trName + l.Tr("form.email_error") - case binding.UrlError: + case binding.ERR_URL: data["ErrorMsg"] = trName + l.Tr("form.url_error") default: data["ErrorMsg"] = l.Tr("form.unknown_error") + " " + errs[0].Classification |