From e1f29c2d3524f9444ec067c52d2c9f1d44fa6539 Mon Sep 17 00:00:00 2001 From: Jonas Hungershausen Date: Mon, 18 Nov 2024 14:43:32 +0100 Subject: [PATCH] fix: add missing autocomplete attributes to identifier_first strategy (#4215) --- ...od=PopulateLoginMethodIdentifierFirstIdentification.json | 1 + selfservice/strategy/idfirst/strategy_login.go | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/selfservice/strategy/idfirst/.snapshots/TestFormHydration-method=PopulateLoginMethodIdentifierFirstIdentification.json b/selfservice/strategy/idfirst/.snapshots/TestFormHydration-method=PopulateLoginMethodIdentifierFirstIdentification.json index 086d65ade752..73e408add0a0 100644 --- a/selfservice/strategy/idfirst/.snapshots/TestFormHydration-method=PopulateLoginMethodIdentifierFirstIdentification.json +++ b/selfservice/strategy/idfirst/.snapshots/TestFormHydration-method=PopulateLoginMethodIdentifierFirstIdentification.json @@ -20,6 +20,7 @@ "type": "text", "value": "", "required": true, + "autocomplete": "username email", "disabled": false, "node_type": "input" }, diff --git a/selfservice/strategy/idfirst/strategy_login.go b/selfservice/strategy/idfirst/strategy_login.go index 17c39fe914d3..0cc7b274b30e 100644 --- a/selfservice/strategy/idfirst/strategy_login.go +++ b/selfservice/strategy/idfirst/strategy_login.go @@ -136,6 +136,7 @@ func (s *Strategy) Login(w http.ResponseWriter, r *http.Request, f *login.Flow, if !ok { continue } + attrs.Autocomplete = "username email" attrs.Type = node.InputAttributeTypeHidden f.UI.Nodes[k].Attributes = attrs @@ -184,7 +185,10 @@ func (s *Strategy) PopulateLoginMethodIdentifierFirstIdentification(r *http.Requ return err } - f.UI.SetNode(node.NewInputField("identifier", "", s.NodeGroup(), node.InputAttributeTypeText, node.WithRequiredInputAttribute).WithMetaLabel(identifierLabel)) + f.UI.SetNode(node.NewInputField("identifier", "", s.NodeGroup(), node.InputAttributeTypeText, node.WithInputAttributes(func(a *node.InputAttributes) { + a.Autocomplete = "username email" + a.Required = true + })).WithMetaLabel(identifierLabel)) f.UI.GetNodes().Append(node.NewInputField("method", s.ID(), s.NodeGroup(), node.InputAttributeTypeSubmit).WithMetaLabel(text.NewInfoNodeLabelContinue())) return nil }