mirror of
https://github.com/pocket-id/pocket-id.git
synced 2025-12-16 10:13:05 +03:00
fix: profile picture empty for users without first or last name (#449)
This commit is contained in:
@@ -67,9 +67,12 @@ func (u User) WebAuthnCredentialDescriptors() (descriptors []protocol.Credential
|
||||
func (u User) FullName() string { return u.FirstName + " " + u.LastName }
|
||||
|
||||
func (u User) Initials() string {
|
||||
return strings.ToUpper(
|
||||
utils.GetFirstCharacter(u.FirstName) + utils.GetFirstCharacter(u.LastName),
|
||||
)
|
||||
first := utils.GetFirstCharacter(u.FirstName)
|
||||
last := utils.GetFirstCharacter(u.LastName)
|
||||
if first == "" && last == "" && len(u.Username) >= 2 {
|
||||
return strings.ToUpper(u.Username[:2])
|
||||
}
|
||||
return strings.ToUpper(first + last)
|
||||
}
|
||||
|
||||
type OneTimeAccessToken struct {
|
||||
|
||||
Reference in New Issue
Block a user