Skip to content

Commit 8de8e11

Browse files
puffybsdlunny
authored andcommitted
Fixes 1019, install page SMTP user is required to (#1020)
to be an email address. Signed-off-by: P.B. <[email protected]>
1 parent 832477b commit 8de8e11

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

modules/auth/user_form.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ type InstallForm struct {
3333

3434
SMTPHost string
3535
SMTPFrom string
36-
SMTPEmail string `binding:"OmitEmpty;Email;MaxSize(254)" locale:"install.mailer_user"`
36+
SMTPUser string `binding:"OmitEmpty;MaxSize(254)" locale:"install.mailer_user"`
3737
SMTPPasswd string
3838
RegisterConfirm bool
3939
MailNotify bool

options/locale/locale_en-US.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ email_title = Email Service Settings
9797
smtp_host = SMTP Host
9898
smtp_from = From
9999
smtp_from_helper = Mail from address, RFC 5322. It can be just an email address, or the "Name" <[email protected]> format.
100-
mailer_user = Sender Email
100+
mailer_user = Sender User
101101
mailer_password = Sender Password
102102
register_confirm = Enable Register Confirmation
103103
mail_notify = Enable Mail Notification

routers/install.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ func Install(ctx *context.Context) {
9999
if setting.MailService != nil {
100100
form.SMTPHost = setting.MailService.Host
101101
form.SMTPFrom = setting.MailService.From
102-
form.SMTPEmail = setting.MailService.User
102+
form.SMTPUser = setting.MailService.User
103103
}
104104
form.RegisterConfirm = setting.Service.RegisterEmailConfirm
105105
form.MailNotify = setting.Service.EnableNotifyMail
@@ -124,7 +124,7 @@ func InstallPost(ctx *context.Context, form auth.InstallForm) {
124124
ctx.Data["CurDbOption"] = form.DbType
125125

126126
if ctx.HasError() {
127-
if ctx.HasValue("Err_SMTPEmail") {
127+
if ctx.HasValue("Err_SMTPUser") {
128128
ctx.Data["Err_SMTP"] = true
129129
}
130130
if ctx.HasValue("Err_AdminName") ||
@@ -279,7 +279,7 @@ func InstallPost(ctx *context.Context, form auth.InstallForm) {
279279
cfg.Section("mailer").Key("ENABLED").SetValue("true")
280280
cfg.Section("mailer").Key("HOST").SetValue(form.SMTPHost)
281281
cfg.Section("mailer").Key("FROM").SetValue(form.SMTPFrom)
282-
cfg.Section("mailer").Key("USER").SetValue(form.SMTPEmail)
282+
cfg.Section("mailer").Key("USER").SetValue(form.SMTPUser)
283283
cfg.Section("mailer").Key("PASSWD").SetValue(form.SMTPPasswd)
284284
} else {
285285
cfg.Section("mailer").Key("ENABLED").SetValue("false")

templates/install.tmpl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,9 @@
140140
<input id="smtp_from" name="smtp_from" value="{{.smtp_from}}">
141141
<span class="help">{{.i18n.Tr "install.smtp_from_helper"}}</span>
142142
</div>
143-
<div class="inline field {{if .Err_SMTPEmail}}error{{end}}">
144-
<label for="smtp_email">{{.i18n.Tr "install.mailer_user"}}</label>
145-
<input id="smtp_email" name="smtp_email" value="{{.smtp_email}}">
143+
<div class="inline field {{if .Err_SMTPUser}}error{{end}}">
144+
<label for="smtp_user">{{.i18n.Tr "install.mailer_user"}}</label>
145+
<input id="smtp_user" name="smtp_user" value="{{.smtp_user}}">
146146
</div>
147147
<div class="inline field">
148148
<label for="smtp_passwd">{{.i18n.Tr "install.mailer_password"}}</label>

0 commit comments

Comments
 (0)