diff options
Diffstat (limited to 'modules/auth')
-rw-r--r-- | modules/auth/auth.go | 9 | ||||
-rw-r--r-- | modules/auth/user_form.go | 22 |
2 files changed, 19 insertions, 12 deletions
diff --git a/modules/auth/auth.go b/modules/auth/auth.go index 5b24591a6f..edcb13069e 100644 --- a/modules/auth/auth.go +++ b/modules/auth/auth.go @@ -208,7 +208,14 @@ func validate(errs binding.Errors, data map[string]interface{}, f Form, l macaro if errs[0].FieldNames[0] == field.Name { data["Err_"+field.Name] = true - trName := l.Tr("form." + field.Name) + + trName := field.Tag.Get("locale") + if len(trName) == 0 { + trName = l.Tr("form." + field.Name) + } else { + trName = l.Tr(trName) + } + switch errs[0].Classification { case binding.ERR_REQUIRED: data["ErrorMsg"] = trName + l.Tr("form.require_error") diff --git a/modules/auth/user_form.go b/modules/auth/user_form.go index b616a460ff..97865bf537 100644 --- a/modules/auth/user_form.go +++ b/modules/auth/user_form.go @@ -17,22 +17,22 @@ type InstallForm struct { DbUser string DbPasswd string DbName string - SSLMode string + SSLMode string `form:"ssl_mode"` DbPath string RepoRootPath string `binding:"Required"` RunUser string `binding:"Required"` Domain string `binding:"Required"` - HTTPPort string `binding:"Required"` + HTTPPort string `form:"http_port" binding:"Required"` AppUrl string `binding:"Required"` - SMTPHost string - SMTPEmail string - SMTPPasswd string - RegisterConfirm string - MailNotify string - AdminName string `binding:"Required;AlphaDashDot;MaxSize(30)"` - AdminPasswd string `binding:"Required;MinSize(6);MaxSize(255)"` - AdminConfirmPasswd string `binding:"Required;MinSize(6);MaxSize(255)"` - AdminEmail string `binding:"Required;Email;MaxSize(50)"` + SMTPHost string `form:"smtp_host"` + SMTPEmail string `form:"smtp_user" binding:"OmitEmpty;Email;MaxSize(50)" locale:"install.mailer_user"` + SMTPPasswd string `form:"smtp_passwd"` + RegisterConfirm bool + MailNotify bool + AdminName string `binding:"OmitEmpty;AlphaDashDot;MaxSize(30)" locale:"install.admin_name"` + AdminPasswd string `binding:"OmitEmpty;MinSize(6);MaxSize(255)" locale:"install.admin_password"` + AdminConfirmPasswd string + AdminEmail string `binding:"OmitEmpty;Email;MaxSize(50)" locale:"install.admin_email"` } func (f *InstallForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors { |