forked from forgejo/forgejo
ldap: default domain name (#3414)
When the ldap synchronizer is look for an email address and fails at finding one, it falls back at creating one using "localhost.local" domain. This new field makes this domain name configurable. Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3414 Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org> Co-authored-by: Baptiste Daroussin <bapt@FreeBSD.org> Co-committed-by: Baptiste Daroussin <bapt@FreeBSD.org>
This commit is contained in:
parent
4da76d0e5f
commit
08f5a25d3b
9 changed files with 105 additions and 16 deletions
|
@ -105,7 +105,11 @@ func (source *Source) Sync(ctx context.Context, updateExisting bool) error {
|
|||
}
|
||||
|
||||
if len(su.Mail) == 0 {
|
||||
su.Mail = fmt.Sprintf("%s@localhost.local", su.Username)
|
||||
domainName := source.DefaultDomainName
|
||||
if len(domainName) == 0 {
|
||||
domainName = "localhost.local"
|
||||
}
|
||||
su.Mail = fmt.Sprintf("%s@%s", su.Username, domainName)
|
||||
}
|
||||
|
||||
fullName := composeFullName(su.Name, su.Surname, su.Username)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue