diff options
author | Unknwon <u@gogs.io> | 2015-07-24 21:02:49 +0800 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2015-07-24 21:02:49 +0800 |
commit | ac95f6d50f674cae1a5ae3889fdf3c56eb7c005d (patch) | |
tree | 274c1e8087aca7b0a366eaf61b08fbd177a52a29 /modules/auth/auth.go | |
parent | 86dbda0b42d05caf11d5c6d040f18dfbcc742e04 (diff) | |
download | gitea-ac95f6d50f674cae1a5ae3889fdf3c56eb7c005d.tar.gz gitea-ac95f6d50f674cae1a5ae3889fdf3c56eb7c005d.zip |
UI: basic label list
- create new label
Diffstat (limited to 'modules/auth/auth.go')
-rw-r--r-- | modules/auth/auth.go | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/modules/auth/auth.go b/modules/auth/auth.go index 4234643023..155a82728c 100644 --- a/modules/auth/auth.go +++ b/modules/auth/auth.go @@ -171,12 +171,16 @@ func AssignForm(form interface{}, data map[string]interface{}) { func getSize(field reflect.StructField, prefix string) string { for _, rule := range strings.Split(field.Tag.Get("binding"), ";") { if strings.HasPrefix(rule, prefix) { - return rule[8 : len(rule)-1] + return rule[len(prefix) : len(rule)-1] } } return "" } +func GetSize(field reflect.StructField) string { + return getSize(field, "Size(") +} + func GetMinSize(field reflect.StructField) string { return getSize(field, "MinSize(") } @@ -227,6 +231,8 @@ func validate(errs binding.Errors, data map[string]interface{}, f Form, l macaro data["ErrorMsg"] = trName + l.Tr("form.alpha_dash_error") case binding.ERR_ALPHA_DASH_DOT: data["ErrorMsg"] = trName + l.Tr("form.alpha_dash_dot_error") + case binding.ERR_SIZE: + data["ErrorMsg"] = trName + l.Tr("form.size_error", GetSize(field)) case binding.ERR_MIN_SIZE: data["ErrorMsg"] = trName + l.Tr("form.min_size_error", GetMinSize(field)) case binding.ERR_MAX_SIZE: |