Skip to content

Commit e316cfc

Browse files
committed
Do not send activation email if manual confirm is set
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 go-gitea#17263 Signed-off-by: Andrew Thornton <[email protected]>
1 parent 45f8d97 commit e316cfc

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

options/locale/locale_en-US.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,7 @@ register_helper_msg = Already have an account? Sign in now!
282282
social_register_helper_msg = Already have an account? Link it now!
283283
disable_register_prompt = Registration is disabled. Please contact your site administrator.
284284
disable_register_mail = Email confirmation for registration is disabled.
285+
manual_activation_only = Contact your site administrator to complete activation.
285286
remember_me = Remember this Device
286287
forgot_password_title= Forgot Password
287288
forgot_password = Forgot password?

routers/web/auth/auth.go

Lines changed: 6 additions & 0 deletions
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

Lines changed: 2 additions & 0 deletions
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.manual_activation_only"}}</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)