From c40d8e16f8014c68db0860c1246c30991b8e621d Mon Sep 17 00:00:00 2001 From: aeneasr <3372410+aeneasr@users.noreply.github.com> Date: Mon, 1 Nov 2021 13:32:15 +0100 Subject: [PATCH] fix: include text label for link email field Closes #1909 --- cmd/clidoc/main.go | 1 + selfservice/strategy/link/strategy_recovery.go | 2 +- selfservice/strategy/link/strategy_verification.go | 2 +- text/message_node.go | 9 +++++++++ 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/cmd/clidoc/main.go b/cmd/clidoc/main.go index 318a38e88271..f2734f696650 100644 --- a/cmd/clidoc/main.go +++ b/cmd/clidoc/main.go @@ -112,6 +112,7 @@ func init() { "NewErrorValidationRecoveryTokenInvalidOrAlreadyUsed": text.NewErrorValidationRecoveryTokenInvalidOrAlreadyUsed(), "NewErrorValidationRecoveryRetrySuccess": text.NewErrorValidationRecoveryRetrySuccess(), "NewErrorValidationRecoveryStateFailure": text.NewErrorValidationRecoveryStateFailure(), + "NewInfoNodeInputEmail": text.NewInfoNodeInputEmail(), } } diff --git a/selfservice/strategy/link/strategy_recovery.go b/selfservice/strategy/link/strategy_recovery.go index 26e85cb2f7bd..343070d403bb 100644 --- a/selfservice/strategy/link/strategy_recovery.go +++ b/selfservice/strategy/link/strategy_recovery.go @@ -48,7 +48,7 @@ func (s *Strategy) PopulateRecoveryMethod(r *http.Request, f *recovery.Flow) err f.UI.SetCSRF(s.d.GenerateCSRFToken(r)) f.UI.GetNodes().Upsert( // v0.5: form.Field{Name: "email", Type: "email", Required: true}, - node.NewInputField("email", nil, node.RecoveryLinkGroup, node.InputAttributeTypeEmail, node.WithRequiredInputAttribute), + node.NewInputField("email", nil, node.RecoveryLinkGroup, node.InputAttributeTypeEmail, node.WithRequiredInputAttribute).WithMetaLabel(text.NewInfoNodeInputEmail()), ) f.UI.GetNodes().Append(node.NewInputField("method", s.RecoveryStrategyID(), node.RecoveryLinkGroup, node.InputAttributeTypeSubmit).WithMetaLabel(text.NewInfoNodeLabelSubmit())) diff --git a/selfservice/strategy/link/strategy_verification.go b/selfservice/strategy/link/strategy_verification.go index 3b8f400f835b..959d1af2d97a 100644 --- a/selfservice/strategy/link/strategy_verification.go +++ b/selfservice/strategy/link/strategy_verification.go @@ -34,7 +34,7 @@ func (s *Strategy) PopulateVerificationMethod(r *http.Request, f *verification.F f.UI.SetCSRF(s.d.GenerateCSRFToken(r)) f.UI.GetNodes().Upsert( // v0.5: form.Field{Name: "email", Type: "email", Required: true} - node.NewInputField("email", nil, node.VerificationLinkGroup, node.InputAttributeTypeEmail, node.WithRequiredInputAttribute), + node.NewInputField("email", nil, node.VerificationLinkGroup, node.InputAttributeTypeEmail, node.WithRequiredInputAttribute).WithMetaLabel(text.NewInfoNodeInputEmail()), ) f.UI.GetNodes().Append(node.NewInputField("method", s.VerificationStrategyID(), node.VerificationLinkGroup, node.InputAttributeTypeSubmit).WithMetaLabel(text.NewInfoNodeLabelSubmit())) return nil diff --git a/text/message_node.go b/text/message_node.go index 3cdb5f580160..8b40178d7628 100644 --- a/text/message_node.go +++ b/text/message_node.go @@ -8,6 +8,7 @@ const ( InfoNodeLabelID // 1070004 InfoNodeLabelSubmit // 1070005 InfoNodeLabelVerifyOTP // 1070006 + InfoNodeLabelEmail // 1070007 ) func NewInfoNodeLabelVerifyOTP() *Message { @@ -57,3 +58,11 @@ func NewInfoNodeLabelID() *Message { Type: Info, } } + +func NewInfoNodeInputEmail() *Message { + return &Message{ + ID: InfoNodeLabelEmail, + Text: "Email", + Type: Info, + } +}