Skip to content

Commit

Permalink
Do not send activation email if manual confirm is set (#19119) (#19122)
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
zeripath authored Mar 19, 2022
1 parent c1e6be4 commit 5bb0c92
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions routers/web/auth/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,12 @@ func handleUserCreated(ctx *context.Context, u *user_model.User, gothUser *goth.

// Send confirmation email
if !u.IsActive && u.ID > 1 {
if setting.Service.RegisterManualConfirm {
ctx.Data["ManualActivationOnly"] = true
ctx.HTML(http.StatusOK, TplActivate)
return
}

mailer.SendActivateAccountMail(ctx.Locale, u)

ctx.Data["IsSendRegisterMail"] = true
Expand Down
2 changes: 2 additions & 0 deletions templates/user/auth/activate.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
<p>{{.i18n.Tr "auth.confirmation_mail_sent_prompt" (.Email|Escape) .ActiveCodeLives | Str2html}}</p>
{{else if .IsActivateFailed}}
<p>{{.i18n.Tr "auth.invalid_code"}}</p>
{{else if .ManualActivationOnly}}
<p class="center">{{.i18n.Tr "auth.disable_register_mail"}}</p>
{{else}}
<p>{{.i18n.Tr "auth.has_unconfirmed_mail" (.SignedUser.Name|Escape) (.SignedUser.Email|Escape) | Str2html}}</p>
<div class="ui divider"></div>
Expand Down

0 comments on commit 5bb0c92

Please sign in to comment.