diff --git a/internal/users/cache/getusers.go b/internal/users/cache/getusers.go index fd5af39f2..b219f23ee 100644 --- a/internal/users/cache/getusers.go +++ b/internal/users/cache/getusers.go @@ -3,6 +3,7 @@ package cache import ( "encoding/json" "fmt" + "strings" "time" "go.etcd.io/bbolt" @@ -42,6 +43,8 @@ func (c *Cache) UserByID(uid uint32) (UserDB, error) { // UserByName returns a user matching this name or an error if the database is corrupted or no entry was found. func (c *Cache) UserByName(name string) (UserDB, error) { + // authd uses lowercase usernames + name = strings.ToLower(name) u, err := getUser(c, userByNameBucketName, name) return u.UserDB, err } diff --git a/pam/internal/adapter/userselection.go b/pam/internal/adapter/userselection.go index 868280cb7..fd722efb6 100644 --- a/pam/internal/adapter/userselection.go +++ b/pam/internal/adapter/userselection.go @@ -3,6 +3,7 @@ package adapter import ( "context" "fmt" + "strings" "github.com/charmbracelet/bubbles/cursor" "github.com/charmbracelet/bubbles/textinput" @@ -148,7 +149,8 @@ func (m userSelectionModel) Username() string { if m.clientType == InteractiveTerminal && !m.selected { return "" } - return m.Model.Value() + // authd uses lowercase usernames + return strings.ToLower(m.Model.Value()) } // Focus sets the focus state on the model. We also mark as the user is not