Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use ID label on login with multiple identifiers #3657

Merged
merged 2 commits into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions selfservice/flow/login/extension_identifier_label.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ package login

import (
"context"
"sort"

"github.com/ory/kratos/text"

"github.com/ory/jsonschema/v3"
Expand Down Expand Up @@ -59,12 +57,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]
}
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