]> source.dussan.org Git - gitea.git/commitdiff
Change default email domain for LDAP users (#25425) (#25434)
authorGiteabot <teabot@gitea.io>
Thu, 22 Jun 2023 10:53:15 +0000 (06:53 -0400)
committerGitHub <noreply@github.com>
Thu, 22 Jun 2023 10:53:15 +0000 (10:53 +0000)
Backport #25425 by @Zettat123

Fixes #21169

Change `localhost` to `localhost.local`

Co-authored-by: Zettat123 <zettat123@gmail.com>
services/auth/source/ldap/source_authenticate.go
services/auth/source/ldap/source_sync.go

index 89e99b5e606c8feaa9c6c183645ce3b999a781c9..3f3219adb9463d4cffa3dee048c08144f0a39c3d 100644 (file)
@@ -76,7 +76,7 @@ func (source *Source) Authenticate(user *user_model.User, userName, password str
                }
 
                if len(sr.Mail) == 0 {
-                       sr.Mail = fmt.Sprintf("%s@localhost", sr.Username)
+                       sr.Mail = fmt.Sprintf("%s@localhost.local", sr.Username)
                }
 
                user = &user_model.User{
index 3e0f47a37e296c9f7becf6df30f2c4d1cc6cd2e1..43ee32c84bdc8d39f7c767e1d6f6b732ae315f10 100644 (file)
@@ -104,7 +104,7 @@ func (source *Source) Sync(ctx context.Context, updateExisting bool) error {
                }
 
                if len(su.Mail) == 0 {
-                       su.Mail = fmt.Sprintf("%s@localhost", su.Username)
+                       su.Mail = fmt.Sprintf("%s@localhost.local", su.Username)
                }
 
                fullName := composeFullName(su.Name, su.Surname, su.Username)