Browse Source

Fixes 1019, install page SMTP user is required to (#1020)

to be an email address.

Signed-off-by: P.B. <puffybsd@yahoo.com>
puffybsd 2 years ago
parent
commit
8de8e11487
4 changed files with 8 additions and 8 deletions
  1. 1 1
      modules/auth/user_form.go
  2. 1 1
      options/locale/locale_en-US.ini
  3. 3 3
      routers/install.go
  4. 3 3
      templates/install.tmpl

+ 1 - 1
modules/auth/user_form.go

@@ -33,7 +33,7 @@ type InstallForm struct {
33 33
 
34 34
 	SMTPHost        string
35 35
 	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"`
37 37
 	SMTPPasswd      string
38 38
 	RegisterConfirm bool
39 39
 	MailNotify      bool

+ 1 - 1
options/locale/locale_en-US.ini

@@ -97,7 +97,7 @@ email_title = Email Service Settings
97 97
 smtp_host = SMTP Host
98 98
 smtp_from = From
99 99
 smtp_from_helper = Mail from address, RFC 5322. It can be just an email address, or the "Name" <email@example.com> format.
100
-mailer_user = Sender Email
100
+mailer_user = Sender User
101 101
 mailer_password = Sender Password
102 102
 register_confirm = Enable Register Confirmation
103 103
 mail_notify = Enable Mail Notification

+ 3 - 3
routers/install.go

@@ -99,7 +99,7 @@ func Install(ctx *context.Context) {
99 99
 	if setting.MailService != nil {
100 100
 		form.SMTPHost = setting.MailService.Host
101 101
 		form.SMTPFrom = setting.MailService.From
102
-		form.SMTPEmail = setting.MailService.User
102
+		form.SMTPUser = setting.MailService.User
103 103
 	}
104 104
 	form.RegisterConfirm = setting.Service.RegisterEmailConfirm
105 105
 	form.MailNotify = setting.Service.EnableNotifyMail
@@ -124,7 +124,7 @@ func InstallPost(ctx *context.Context, form auth.InstallForm) {
124 124
 	ctx.Data["CurDbOption"] = form.DbType
125 125
 
126 126
 	if ctx.HasError() {
127
-		if ctx.HasValue("Err_SMTPEmail") {
127
+		if ctx.HasValue("Err_SMTPUser") {
128 128
 			ctx.Data["Err_SMTP"] = true
129 129
 		}
130 130
 		if ctx.HasValue("Err_AdminName") ||
@@ -279,7 +279,7 @@ func InstallPost(ctx *context.Context, form auth.InstallForm) {
279 279
 		cfg.Section("mailer").Key("ENABLED").SetValue("true")
280 280
 		cfg.Section("mailer").Key("HOST").SetValue(form.SMTPHost)
281 281
 		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)
283 283
 		cfg.Section("mailer").Key("PASSWD").SetValue(form.SMTPPasswd)
284 284
 	} else {
285 285
 		cfg.Section("mailer").Key("ENABLED").SetValue("false")

+ 3 - 3
templates/install.tmpl

@@ -140,9 +140,9 @@
140 140
 								<input id="smtp_from" name="smtp_from" value="{{.smtp_from}}">
141 141
 								<span class="help">{{.i18n.Tr "install.smtp_from_helper"}}</span>
142 142
 							</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}}">
146 146
 							</div>
147 147
 							<div class="inline field">
148 148
 								<label for="smtp_passwd">{{.i18n.Tr "install.mailer_password"}}</label>