Skip to content

Commit

Permalink
fix: use ID label on login with multiple identifiers (#3657)
Browse files Browse the repository at this point in the history
  • Loading branch information
zepatrik authored Dec 11, 2023
1 parent 52c7d3b commit be907db
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
6 changes: 1 addition & 5 deletions selfservice/flow/login/extension_identifier_label.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ package login

import (
"context"
"sort"

"github.com/ory/kratos/text"

Expand Down Expand Up @@ -59,12 +58,9 @@ func (i *identifierLabelExtension) Run(_ jsonschema.CompilerContext, config sche
}

func (i *identifierLabelExtension) getLabel() string {
if len(i.identifierLabelCandidates) == 0 {
if len(i.identifierLabelCandidates) != 1 {
// sane default is set elsewhere
return ""
}
// sort the candidates to get a deterministic result
sort.Strings(i.identifierLabelCandidates)
// just take the first, no good way to decide which one is the best
return i.identifierLabelCandidates[0]
}
2 changes: 1 addition & 1 deletion selfservice/flow/login/extension_identifier_label_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ func TestGetIdentifierLabelFromSchema(t *testing.T) {
usernameConfig: func(c *schema.ExtensionConfig) {
c.Credentials.Password.Identifier = true
},
expected: text.NewInfoNodeLabelGenerated("Email"),
expected: text.NewInfoNodeLabelID(),
},
{
name: "no identifiers",
Expand Down

0 comments on commit be907db

Please sign in to comment.