1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-11-28 09:21:13 -05:00

use local fqdn for generated user email

This commit is contained in:
Michael Jerger 2024-02-07 14:59:39 +01:00
parent 5a7f6f15a6
commit a1ca7e958a

View file

@ -6,6 +6,7 @@ package activitypub
import ( import (
"fmt" "fmt"
"net/http" "net/http"
"net/url"
"strings" "strings"
"code.gitea.io/gitea/models/db" "code.gitea.io/gitea/models/db"
@ -268,7 +269,12 @@ func createUserFromAP(ctx *context.APIContext, personID forgefed.PersonID) (*use
} }
log.Info("RepositoryInbox: validated person: %q", person) log.Info("RepositoryInbox: validated person: %q", person)
email := fmt.Sprintf("f%v@%v", uuid.New().String(), personID.Host) localFqdn, err := url.ParseRequestURI(setting.AppURL)
if err != nil {
return &user_model.User{}, err
}
email := fmt.Sprintf("f%v@%v", uuid.New().String(), localFqdn.Hostname())
loginName := personID.AsLoginName() loginName := personID.AsLoginName()
name := fmt.Sprintf("%v%v", person.PreferredUsername.String(), personID.HostSuffix()) name := fmt.Sprintf("%v%v", person.PreferredUsername.String(), personID.HostSuffix())
log.Info("RepositoryInbox: person.Name: %v", person.Name) log.Info("RepositoryInbox: person.Name: %v", person.Name)