Skip to content

Commit 4127cbb

Browse files
authored
fix(sdk): add missing enum type to autocomplete (#4396)
-
1 parent 4916616 commit 4127cbb

File tree

8 files changed

+25
-18
lines changed

8 files changed

+25
-18
lines changed

internal/client-go/model_ui_node_input_attributes.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/httpclient/model_ui_node_input_attributes.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

selfservice/strategy/idfirst/strategy_login.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ func (s *Strategy) Login(w http.ResponseWriter, r *http.Request, f *login.Flow,
136136
if !ok {
137137
continue
138138
}
139-
attrs.Autocomplete = "username webauthn"
139+
attrs.Autocomplete = node.InputAttributeAutocompleteUsernameWebauthn
140140

141141
attrs.Type = node.InputAttributeTypeHidden
142142
f.UI.Nodes[k].Attributes = attrs
@@ -186,7 +186,7 @@ func (s *Strategy) PopulateLoginMethodIdentifierFirstIdentification(r *http.Requ
186186
}
187187

188188
f.UI.SetNode(node.NewInputField("identifier", "", s.NodeGroup(), node.InputAttributeTypeText, node.WithInputAttributes(func(a *node.InputAttributes) {
189-
a.Autocomplete = "username webauthn"
189+
a.Autocomplete = node.InputAttributeAutocompleteUsernameWebauthn
190190
a.Required = true
191191
})).WithMetaLabel(identifierLabel))
192192
f.UI.GetNodes().Append(node.NewInputField("method", s.ID(), s.NodeGroup(), node.InputAttributeTypeSubmit).WithMetaLabel(text.NewInfoNodeLabelContinue()))

selfservice/strategy/passkey/passkey_login.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,9 @@ func (s *Strategy) populateLoginMethodForPasskeys(r *http.Request, loginFlow *lo
8989
node.DefaultGroup,
9090
node.InputAttributeTypeText,
9191
node.WithRequiredInputAttribute,
92-
func(attributes *node.InputAttributes) { attributes.Autocomplete = "username webauthn" },
92+
func(attributes *node.InputAttributes) {
93+
attributes.Autocomplete = node.InputAttributeAutocompleteUsernameWebauthn
94+
},
9395
).WithMetaLabel(identifierLabel))
9496

9597
loginFlow.UI.Nodes.Upsert(&node.Node{

selfservice/strategy/webauthn/login.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,9 @@ func (s *Strategy) PopulateLoginMethodFirstFactor(r *http.Request, sr *login.Flo
364364
node.DefaultGroup,
365365
node.InputAttributeTypeText,
366366
node.WithRequiredInputAttribute,
367-
func(attributes *node.InputAttributes) { attributes.Autocomplete = "username webauthn" },
367+
func(attributes *node.InputAttributes) {
368+
attributes.Autocomplete = node.InputAttributeAutocompleteUsernameWebauthn
369+
},
368370
).WithMetaLabel(identifierLabel))
369371

370372
if err := s.populateLoginMethodForPasswordless(r, sr); errors.Is(err, webauthnx.ErrNoCredentials) {

spec/api.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2574,17 +2574,18 @@
25742574
"description": "InputAttributes represents the attributes of an input node",
25752575
"properties": {
25762576
"autocomplete": {
2577-
"description": "The autocomplete attribute for the input.\nemail InputAttributeAutocompleteEmail\ntel InputAttributeAutocompleteTel\nurl InputAttributeAutocompleteUrl\ncurrent-password InputAttributeAutocompleteCurrentPassword\nnew-password InputAttributeAutocompleteNewPassword\none-time-code InputAttributeAutocompleteOneTimeCode",
2577+
"description": "The autocomplete attribute for the input.\nemail InputAttributeAutocompleteEmail\ntel InputAttributeAutocompleteTel\nurl InputAttributeAutocompleteUrl\ncurrent-password InputAttributeAutocompleteCurrentPassword\nnew-password InputAttributeAutocompleteNewPassword\none-time-code InputAttributeAutocompleteOneTimeCode\nusername webauthn InputAttributeAutocompleteUsernameWebauthn",
25782578
"enum": [
25792579
"email",
25802580
"tel",
25812581
"url",
25822582
"current-password",
25832583
"new-password",
2584-
"one-time-code"
2584+
"one-time-code",
2585+
"username webauthn"
25852586
],
25862587
"type": "string",
2587-
"x-go-enum-desc": "email InputAttributeAutocompleteEmail\ntel InputAttributeAutocompleteTel\nurl InputAttributeAutocompleteUrl\ncurrent-password InputAttributeAutocompleteCurrentPassword\nnew-password InputAttributeAutocompleteNewPassword\none-time-code InputAttributeAutocompleteOneTimeCode"
2588+
"x-go-enum-desc": "email InputAttributeAutocompleteEmail\ntel InputAttributeAutocompleteTel\nurl InputAttributeAutocompleteUrl\ncurrent-password InputAttributeAutocompleteCurrentPassword\nnew-password InputAttributeAutocompleteNewPassword\none-time-code InputAttributeAutocompleteOneTimeCode\nusername webauthn InputAttributeAutocompleteUsernameWebauthn"
25882589
},
25892590
"disabled": {
25902591
"description": "Sets the input's disabled field to true or false.",

spec/swagger.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5766,17 +5766,18 @@
57665766
],
57675767
"properties": {
57685768
"autocomplete": {
5769-
"description": "The autocomplete attribute for the input.\nemail InputAttributeAutocompleteEmail\ntel InputAttributeAutocompleteTel\nurl InputAttributeAutocompleteUrl\ncurrent-password InputAttributeAutocompleteCurrentPassword\nnew-password InputAttributeAutocompleteNewPassword\none-time-code InputAttributeAutocompleteOneTimeCode",
5769+
"description": "The autocomplete attribute for the input.\nemail InputAttributeAutocompleteEmail\ntel InputAttributeAutocompleteTel\nurl InputAttributeAutocompleteUrl\ncurrent-password InputAttributeAutocompleteCurrentPassword\nnew-password InputAttributeAutocompleteNewPassword\none-time-code InputAttributeAutocompleteOneTimeCode\nusername webauthn InputAttributeAutocompleteUsernameWebauthn",
57705770
"type": "string",
57715771
"enum": [
57725772
"email",
57735773
"tel",
57745774
"url",
57755775
"current-password",
57765776
"new-password",
5777-
"one-time-code"
5777+
"one-time-code",
5778+
"username webauthn"
57785779
],
5779-
"x-go-enum-desc": "email InputAttributeAutocompleteEmail\ntel InputAttributeAutocompleteTel\nurl InputAttributeAutocompleteUrl\ncurrent-password InputAttributeAutocompleteCurrentPassword\nnew-password InputAttributeAutocompleteNewPassword\none-time-code InputAttributeAutocompleteOneTimeCode"
5780+
"x-go-enum-desc": "email InputAttributeAutocompleteEmail\ntel InputAttributeAutocompleteTel\nurl InputAttributeAutocompleteUrl\ncurrent-password InputAttributeAutocompleteCurrentPassword\nnew-password InputAttributeAutocompleteNewPassword\none-time-code InputAttributeAutocompleteOneTimeCode\nusername webauthn InputAttributeAutocompleteUsernameWebauthn"
57805781
},
57815782
"disabled": {
57825783
"description": "Sets the input's disabled field to true or false.",

ui/node/attributes.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,13 @@ const (
2626
)
2727

2828
const (
29-
InputAttributeAutocompleteEmail UiNodeInputAttributeAutocomplete = "email"
30-
InputAttributeAutocompleteTel UiNodeInputAttributeAutocomplete = "tel"
31-
InputAttributeAutocompleteUrl UiNodeInputAttributeAutocomplete = "url"
32-
InputAttributeAutocompleteCurrentPassword UiNodeInputAttributeAutocomplete = "current-password"
33-
InputAttributeAutocompleteNewPassword UiNodeInputAttributeAutocomplete = "new-password"
34-
InputAttributeAutocompleteOneTimeCode UiNodeInputAttributeAutocomplete = "one-time-code"
29+
InputAttributeAutocompleteEmail UiNodeInputAttributeAutocomplete = "email"
30+
InputAttributeAutocompleteTel UiNodeInputAttributeAutocomplete = "tel"
31+
InputAttributeAutocompleteUrl UiNodeInputAttributeAutocomplete = "url"
32+
InputAttributeAutocompleteCurrentPassword UiNodeInputAttributeAutocomplete = "current-password"
33+
InputAttributeAutocompleteNewPassword UiNodeInputAttributeAutocomplete = "new-password"
34+
InputAttributeAutocompleteOneTimeCode UiNodeInputAttributeAutocomplete = "one-time-code"
35+
InputAttributeAutocompleteUsernameWebauthn UiNodeInputAttributeAutocomplete = "username webauthn"
3536
)
3637

3738
// swagger:enum UiNodeInputAttributeType

0 commit comments

Comments
 (0)