aboutsummaryrefslogtreecommitdiffstats
path: root/services/mailer
diff options
context:
space:
mode:
authorJack Hay <jack@allspice.io>2023-09-07 10:50:45 -0400
committerGitHub <noreply@github.com>2023-09-07 14:50:45 +0000
commit1a9953348cbb8e8205dc1f923d17b3e40e9f64e0 (patch)
tree5439dbd2d3c89820ed579ba6c7f1597b649f5c95 /services/mailer
parent30cea70dd8e0a4583d8f63795b21551ce44ce223 (diff)
downloadgitea-1a9953348cbb8e8205dc1f923d17b3e40e9f64e0.tar.gz
gitea-1a9953348cbb8e8205dc1f923d17b3e40e9f64e0.zip
Team invite url fix when registration disabled (#26950)
This is a follow-on to https://github.com/go-gitea/gitea/pull/26550 and fixes the case where the team invite links to the registration page if it is disabled in settings.
Diffstat (limited to 'services/mailer')
-rw-r--r--services/mailer/mail_team_invite.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/services/mailer/mail_team_invite.go b/services/mailer/mail_team_invite.go
index 1403923c79..88ad0c9836 100644
--- a/services/mailer/mail_team_invite.go
+++ b/services/mailer/mail_team_invite.go
@@ -46,8 +46,8 @@ func MailTeamInvite(ctx context.Context, inviter *user_model.User, team *org_mod
inviteRedirect := url.QueryEscape(fmt.Sprintf("/org/invite/%s", invite.Token))
inviteURL := fmt.Sprintf("%suser/sign_up?redirect_to=%s", setting.AppURL, inviteRedirect)
- if err == nil && user != nil {
- // user account exists
+ if (err == nil && user != nil) || setting.Service.DisableRegistration || setting.Service.AllowOnlyExternalRegistration {
+ // user account exists or registration disabled
inviteURL = fmt.Sprintf("%suser/login?redirect_to=%s", setting.AppURL, inviteRedirect)
}