fix: ensure file descriptors are closed + other bugs (#413)

This commit is contained in:
Alessandro (Ale) Segala
2025-04-04 01:04:36 -07:00
committed by GitHub
parent 980780e48b
commit 2f7646105e
6 changed files with 52 additions and 15 deletions

View File

@@ -6,6 +6,7 @@ import (
"github.com/go-webauthn/webauthn/protocol"
"github.com/go-webauthn/webauthn/webauthn"
datatype "github.com/pocket-id/pocket-id/backend/internal/model/types"
"github.com/pocket-id/pocket-id/backend/internal/utils"
)
type User struct {
@@ -66,14 +67,9 @@ func (u User) WebAuthnCredentialDescriptors() (descriptors []protocol.Credential
func (u User) FullName() string { return u.FirstName + " " + u.LastName }
func (u User) Initials() string {
initials := ""
if len(u.FirstName) > 0 {
initials += string(u.FirstName[0])
}
if len(u.LastName) > 0 {
initials += string(u.LastName[0])
}
return strings.ToUpper(initials)
return strings.ToUpper(
utils.GetFirstCharacter(u.FirstName) + utils.GetFirstCharacter(u.LastName),
)
}
type OneTimeAccessToken struct {