forked from gitea/gitea
1
0
Fork 0

Do not send "registration success email" for external auth sources (#24632)

Co-author: @pboguslawski 


"registration success email" is only used for notifying a user that "you
have a new account now" when the account is created by admin manually.

When a user uses external auth source, they already knows that they has
the account, so do not send such email.

Co-authored-by: Giteabot <teabot@gitea.io>
This commit is contained in:
wxiaoguang 2023-05-10 18:49:47 +08:00 committed by GitHub
parent 35ab5cdedf
commit 0ca5adee16
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 0 additions and 15 deletions

View File

@ -13,7 +13,6 @@ import (
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/util"
"code.gitea.io/gitea/modules/web/middleware"
"code.gitea.io/gitea/services/mailer"
gouuid "github.com/google/uuid"
)
@ -172,7 +171,5 @@ func (r *ReverseProxy) newUser(req *http.Request) *user_model.User {
return nil
}
mailer.SendRegisterNotifyMail(user)
return user
}

View File

@ -14,7 +14,6 @@ import (
auth_module "code.gitea.io/gitea/modules/auth"
"code.gitea.io/gitea/modules/util"
source_service "code.gitea.io/gitea/services/auth/source"
"code.gitea.io/gitea/services/mailer"
user_service "code.gitea.io/gitea/services/user"
)
@ -100,8 +99,6 @@ func (source *Source) Authenticate(user *user_model.User, userName, password str
return user, err
}
mailer.SendRegisterNotifyMail(user)
if isAttributeSSHPublicKeySet && asymkey_model.AddPublicKeysBySource(user, source.authSource, sr.SSHPublicKey) {
if err := asymkey_model.RewriteAllPublicKeys(); err != nil {
return user, err

View File

@ -12,7 +12,6 @@ import (
"code.gitea.io/gitea/modules/auth/pam"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/util"
"code.gitea.io/gitea/services/mailer"
"github.com/google/uuid"
)
@ -67,8 +66,6 @@ func (source *Source) Authenticate(user *user_model.User, userName, password str
return user, err
}
mailer.SendRegisterNotifyMail(user)
return user, nil
}

View File

@ -12,7 +12,6 @@ import (
auth_model "code.gitea.io/gitea/models/auth"
user_model "code.gitea.io/gitea/models/user"
"code.gitea.io/gitea/modules/util"
"code.gitea.io/gitea/services/mailer"
)
// Authenticate queries if the provided login/password is authenticates against the SMTP server
@ -82,8 +81,6 @@ func (source *Source) Authenticate(user *user_model.User, userName, password str
return user, err
}
mailer.SendRegisterNotifyMail(user)
return user, nil
}

View File

@ -19,7 +19,6 @@ import (
"code.gitea.io/gitea/modules/util"
"code.gitea.io/gitea/modules/web/middleware"
"code.gitea.io/gitea/services/auth/source/sspi"
"code.gitea.io/gitea/services/mailer"
gouuid "github.com/google/uuid"
"github.com/quasoft/websspi"
@ -191,8 +190,6 @@ func (s *SSPI) newUser(username string, cfg *sspi.Source) (*user_model.User, err
return nil, err
}
mailer.SendRegisterNotifyMail(user)
return user, nil
}