1
0
mirror of https://github.com/pocket-id/pocket-id.git synced 2026-03-23 22:50:06 +00:00

feat: allow first name and display name to be optional (#1288)

Co-authored-by: Kyle Mendell <kmendell@ofkm.us>
This commit is contained in:
taoso
2026-03-04 05:37:39 +08:00
committed by GitHub
parent d7f19ad5e5
commit 8fecc22888
10 changed files with 56 additions and 30 deletions

View File

@@ -39,7 +39,7 @@ func (u User) WebAuthnDisplayName() string {
if u.DisplayName != "" {
return u.DisplayName
}
return u.FirstName + " " + u.LastName
return u.FullName()
}
func (u User) WebAuthnIcon() string { return "" }
@@ -76,7 +76,16 @@ func (u User) WebAuthnCredentialDescriptors() (descriptors []protocol.Credential
}
func (u User) FullName() string {
return u.FirstName + " " + u.LastName
fullname := strings.TrimSpace(u.FirstName + " " + u.LastName)
if fullname != "" {
return fullname
}
if u.DisplayName != "" {
return u.DisplayName
}
return u.Username
}
func (u User) Initials() string {