From 8de8e11487ebd729d026c8a71adfa9ea6b926a69 Mon Sep 17 00:00:00 2001 From: puffybsd Date: Thu, 23 Feb 2017 20:37:13 -0500 Subject: [PATCH] Fixes 1019, install page SMTP user is required to (#1020) to be an email address. Signed-off-by: P.B. --- modules/auth/user_form.go | 2 +- options/locale/locale_en-US.ini | 2 +- routers/install.go | 6 +++--- templates/install.tmpl | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/modules/auth/user_form.go b/modules/auth/user_form.go index 0750d2219..32c18872f 100644 --- a/modules/auth/user_form.go +++ b/modules/auth/user_form.go @@ -33,7 +33,7 @@ type InstallForm struct { SMTPHost string SMTPFrom string - SMTPEmail string `binding:"OmitEmpty;Email;MaxSize(254)" locale:"install.mailer_user"` + SMTPUser string `binding:"OmitEmpty;MaxSize(254)" locale:"install.mailer_user"` SMTPPasswd string RegisterConfirm bool MailNotify bool diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 9043ff12b..5a8b4ebd2 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -97,7 +97,7 @@ email_title = Email Service Settings smtp_host = SMTP Host smtp_from = From smtp_from_helper = Mail from address, RFC 5322. It can be just an email address, or the "Name" format. -mailer_user = Sender Email +mailer_user = Sender User mailer_password = Sender Password register_confirm = Enable Register Confirmation mail_notify = Enable Mail Notification diff --git a/routers/install.go b/routers/install.go index 664489570..b4df536d0 100644 --- a/routers/install.go +++ b/routers/install.go @@ -99,7 +99,7 @@ func Install(ctx *context.Context) { if setting.MailService != nil { form.SMTPHost = setting.MailService.Host form.SMTPFrom = setting.MailService.From - form.SMTPEmail = setting.MailService.User + form.SMTPUser = setting.MailService.User } form.RegisterConfirm = setting.Service.RegisterEmailConfirm form.MailNotify = setting.Service.EnableNotifyMail @@ -124,7 +124,7 @@ func InstallPost(ctx *context.Context, form auth.InstallForm) { ctx.Data["CurDbOption"] = form.DbType if ctx.HasError() { - if ctx.HasValue("Err_SMTPEmail") { + if ctx.HasValue("Err_SMTPUser") { ctx.Data["Err_SMTP"] = true } if ctx.HasValue("Err_AdminName") || @@ -279,7 +279,7 @@ func InstallPost(ctx *context.Context, form auth.InstallForm) { cfg.Section("mailer").Key("ENABLED").SetValue("true") cfg.Section("mailer").Key("HOST").SetValue(form.SMTPHost) cfg.Section("mailer").Key("FROM").SetValue(form.SMTPFrom) - cfg.Section("mailer").Key("USER").SetValue(form.SMTPEmail) + cfg.Section("mailer").Key("USER").SetValue(form.SMTPUser) cfg.Section("mailer").Key("PASSWD").SetValue(form.SMTPPasswd) } else { cfg.Section("mailer").Key("ENABLED").SetValue("false") diff --git a/templates/install.tmpl b/templates/install.tmpl index 5fc056c55..d084005c8 100644 --- a/templates/install.tmpl +++ b/templates/install.tmpl @@ -140,9 +140,9 @@ {{.i18n.Tr "install.smtp_from_helper"}} -
- - +
+ +