Fixes 1019, install page SMTP user is required to (#1020)
to be an email address. Signed-off-by: P.B. <puffybsd@yahoo.com>
This commit is contained in:
parent
832477b1bc
commit
8de8e11487
|
@ -33,7 +33,7 @@ type InstallForm struct {
|
||||||
|
|
||||||
SMTPHost string
|
SMTPHost string
|
||||||
SMTPFrom 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
|
SMTPPasswd string
|
||||||
RegisterConfirm bool
|
RegisterConfirm bool
|
||||||
MailNotify bool
|
MailNotify bool
|
||||||
|
|
|
@ -97,7 +97,7 @@ email_title = Email Service Settings
|
||||||
smtp_host = SMTP Host
|
smtp_host = SMTP Host
|
||||||
smtp_from = From
|
smtp_from = From
|
||||||
smtp_from_helper = Mail from address, RFC 5322. It can be just an email address, or the "Name" <email@example.com> format.
|
smtp_from_helper = Mail from address, RFC 5322. It can be just an email address, or the "Name" <email@example.com> format.
|
||||||
mailer_user = Sender Email
|
mailer_user = Sender User
|
||||||
mailer_password = Sender Password
|
mailer_password = Sender Password
|
||||||
register_confirm = Enable Register Confirmation
|
register_confirm = Enable Register Confirmation
|
||||||
mail_notify = Enable Mail Notification
|
mail_notify = Enable Mail Notification
|
||||||
|
|
|
@ -99,7 +99,7 @@ func Install(ctx *context.Context) {
|
||||||
if setting.MailService != nil {
|
if setting.MailService != nil {
|
||||||
form.SMTPHost = setting.MailService.Host
|
form.SMTPHost = setting.MailService.Host
|
||||||
form.SMTPFrom = setting.MailService.From
|
form.SMTPFrom = setting.MailService.From
|
||||||
form.SMTPEmail = setting.MailService.User
|
form.SMTPUser = setting.MailService.User
|
||||||
}
|
}
|
||||||
form.RegisterConfirm = setting.Service.RegisterEmailConfirm
|
form.RegisterConfirm = setting.Service.RegisterEmailConfirm
|
||||||
form.MailNotify = setting.Service.EnableNotifyMail
|
form.MailNotify = setting.Service.EnableNotifyMail
|
||||||
|
@ -124,7 +124,7 @@ func InstallPost(ctx *context.Context, form auth.InstallForm) {
|
||||||
ctx.Data["CurDbOption"] = form.DbType
|
ctx.Data["CurDbOption"] = form.DbType
|
||||||
|
|
||||||
if ctx.HasError() {
|
if ctx.HasError() {
|
||||||
if ctx.HasValue("Err_SMTPEmail") {
|
if ctx.HasValue("Err_SMTPUser") {
|
||||||
ctx.Data["Err_SMTP"] = true
|
ctx.Data["Err_SMTP"] = true
|
||||||
}
|
}
|
||||||
if ctx.HasValue("Err_AdminName") ||
|
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("ENABLED").SetValue("true")
|
||||||
cfg.Section("mailer").Key("HOST").SetValue(form.SMTPHost)
|
cfg.Section("mailer").Key("HOST").SetValue(form.SMTPHost)
|
||||||
cfg.Section("mailer").Key("FROM").SetValue(form.SMTPFrom)
|
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)
|
cfg.Section("mailer").Key("PASSWD").SetValue(form.SMTPPasswd)
|
||||||
} else {
|
} else {
|
||||||
cfg.Section("mailer").Key("ENABLED").SetValue("false")
|
cfg.Section("mailer").Key("ENABLED").SetValue("false")
|
||||||
|
|
|
@ -140,9 +140,9 @@
|
||||||
<input id="smtp_from" name="smtp_from" value="{{.smtp_from}}">
|
<input id="smtp_from" name="smtp_from" value="{{.smtp_from}}">
|
||||||
<span class="help">{{.i18n.Tr "install.smtp_from_helper"}}</span>
|
<span class="help">{{.i18n.Tr "install.smtp_from_helper"}}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="inline field {{if .Err_SMTPEmail}}error{{end}}">
|
<div class="inline field {{if .Err_SMTPUser}}error{{end}}">
|
||||||
<label for="smtp_email">{{.i18n.Tr "install.mailer_user"}}</label>
|
<label for="smtp_user">{{.i18n.Tr "install.mailer_user"}}</label>
|
||||||
<input id="smtp_email" name="smtp_email" value="{{.smtp_email}}">
|
<input id="smtp_user" name="smtp_user" value="{{.smtp_user}}">
|
||||||
</div>
|
</div>
|
||||||
<div class="inline field">
|
<div class="inline field">
|
||||||
<label for="smtp_passwd">{{.i18n.Tr "install.mailer_password"}}</label>
|
<label for="smtp_passwd">{{.i18n.Tr "install.mailer_password"}}</label>
|
||||||
|
|
Loading…
Reference in New Issue