Skip to content

Commit 5bb0c92

Browse files
authored
Do not send activation email if manual confirm is set (#19119) (#19122)
Backport #19119 If the mailer is configured then even if Manual confirm is set an activation email is still being sent because `handleUserCreated` is not checking for this case. Fix #17263 Signed-off-by: Andrew Thornton <art27@cantab.net>
1 parent c1e6be4 commit 5bb0c92

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

routers/web/auth/auth.go

+6
Original file line numberDiff line numberDiff line change
@@ -621,6 +621,12 @@ func handleUserCreated(ctx *context.Context, u *user_model.User, gothUser *goth.
621621

622622
// Send confirmation email
623623
if !u.IsActive && u.ID > 1 {
624+
if setting.Service.RegisterManualConfirm {
625+
ctx.Data["ManualActivationOnly"] = true
626+
ctx.HTML(http.StatusOK, TplActivate)
627+
return
628+
}
629+
624630
mailer.SendActivateAccountMail(ctx.Locale, u)
625631

626632
ctx.Data["IsSendRegisterMail"] = true

templates/user/auth/activate.tmpl

+2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
<p>{{.i18n.Tr "auth.confirmation_mail_sent_prompt" (.Email|Escape) .ActiveCodeLives | Str2html}}</p>
3333
{{else if .IsActivateFailed}}
3434
<p>{{.i18n.Tr "auth.invalid_code"}}</p>
35+
{{else if .ManualActivationOnly}}
36+
<p class="center">{{.i18n.Tr "auth.disable_register_mail"}}</p>
3537
{{else}}
3638
<p>{{.i18n.Tr "auth.has_unconfirmed_mail" (.SignedUser.Name|Escape) (.SignedUser.Email|Escape) | Str2html}}</p>
3739
<div class="ui divider"></div>

0 commit comments

Comments
 (0)