fix: set displayname correctly in EnsureDisplayName (#5702)

fix: EnsureDisplayName
This commit is contained in:
Livio Spring
2023-04-17 08:26:40 +02:00
committed by GitHub
parent e79e280dc7
commit 8e19f0f6c3
2 changed files with 85 additions and 1 deletions

View File

@@ -91,7 +91,13 @@ func (u *Human) CheckDomainPolicy(policy *DomainPolicy) error {
}
func (u *Human) EnsureDisplayName() {
if u.Profile != nil && u.DisplayName == "" && u.FirstName != "" && u.LastName != "" {
if u.Profile == nil {
u.Profile = new(Profile)
}
if u.DisplayName != "" {
return
}
if u.FirstName != "" && u.LastName != "" {
u.DisplayName = u.FirstName + " " + u.LastName
return
}