mirror of
https://github.com/pocket-id/pocket-id.git
synced 2025-12-21 17:25:44 +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) FullName() string { return u.FirstName + " " + u.LastName }
|
||||||
|
|
||||||
func (u User) Initials() string {
|
func (u User) Initials() string {
|
||||||
return strings.ToUpper(
|
first := utils.GetFirstCharacter(u.FirstName)
|
||||||
utils.GetFirstCharacter(u.FirstName) + utils.GetFirstCharacter(u.LastName),
|
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 {
|
type OneTimeAccessToken struct {
|
||||||
|
|||||||
Reference in New Issue
Block a user