Skip to content

Commit ea8b181

Browse files
committed
feat: Improve default text for verification code sent state to be inclusive of non-email methods
1 parent d5f747c commit ea8b181

File tree

6 files changed

+16
-13
lines changed

6 files changed

+16
-13
lines changed

cmd/clidoc/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ func init() {
7676
"NewErrorValidationVerificationFlowExpired": text.NewErrorValidationVerificationFlowExpired(aSecondAgo),
7777
"NewInfoSelfServiceVerificationSuccessful": text.NewInfoSelfServiceVerificationSuccessful(),
7878
"NewVerificationEmailSent": text.NewVerificationEmailSent(),
79-
"NewVerificationEmailWithCodeSent": text.NewVerificationEmailWithCodeSent(),
79+
"NewVerificationMessageWithCodeSent": text.NewVerificationMessageWithCodeSent(),
8080
"NewErrorValidationVerificationTokenInvalidOrAlreadyUsed": text.NewErrorValidationVerificationTokenInvalidOrAlreadyUsed(),
8181
"NewErrorValidationVerificationRetrySuccess": text.NewErrorValidationVerificationRetrySuccess(),
8282
"NewErrorValidationVerificationStateFailure": text.NewErrorValidationVerificationStateFailure(),

selfservice/strategy/code/strategy.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ func (s *Strategy) populateSecretSentFlow(ctx context.Context, f flow.Flow) erro
379379
case flow.VerificationFlow:
380380
route = verification.RouteSubmitFlow
381381
codeMetaLabel = text.NewInfoNodeLabelVerificationCode()
382-
message = text.NewVerificationEmailWithCodeSent()
382+
message = text.NewVerificationMessageWithCodeSent()
383383

384384
case flow.LoginFlow:
385385
route = login.RouteSubmitFlow
@@ -533,4 +533,4 @@ func MaskAddress(input string) string {
533533
return input
534534
}
535535
return input[:3] + strings.Repeat("*", 4) + input[len(input)-2:]
536-
}
536+
}

selfservice/strategy/code/strategy_verification_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ func TestVerification(t *testing.T) {
200200
check := func(t *testing.T, actual string) {
201201
assert.EqualValues(t, string(node.CodeGroup), gjson.Get(actual, "active").String(), "%s", actual)
202202
assert.EqualValues(t, email, gjson.Get(actual, "ui.nodes.#(attributes.name==email).attributes.value").String(), "%s", actual)
203-
assertx.EqualAsJSON(t, text.NewVerificationEmailWithCodeSent(), json.RawMessage(gjson.Get(actual, "ui.messages.0").Raw))
203+
assertx.EqualAsJSON(t, text.NewVerificationMessageWithCodeSent(), json.RawMessage(gjson.Get(actual, "ui.messages.0").Raw))
204204

205205
message := testhelpers.CourierExpectMessage(ctx, t, reg, email, "Someone tried to verify this email address")
206206
assert.Contains(t, message.Body, "If this was you, check if you signed up using a different address.")
@@ -308,7 +308,7 @@ func TestVerification(t *testing.T) {
308308
check := func(t *testing.T, actual string) {
309309
assert.EqualValues(t, string(node.CodeGroup), gjson.Get(actual, "active").String(), "%s", actual)
310310
assert.EqualValues(t, verificationEmail, gjson.Get(actual, "ui.nodes.#(attributes.name==email).attributes.value").String(), "%s", actual)
311-
assertx.EqualAsJSON(t, text.NewVerificationEmailWithCodeSent(), json.RawMessage(gjson.Get(actual, "ui.messages.0").Raw))
311+
assertx.EqualAsJSON(t, text.NewVerificationMessageWithCodeSent(), json.RawMessage(gjson.Get(actual, "ui.messages.0").Raw))
312312

313313
message := testhelpers.CourierExpectMessage(ctx, t, reg, verificationEmail, "Use code")
314314
assert.Contains(t, message.Body, "Verify your account with the following code")
@@ -664,7 +664,8 @@ func TestVerification(t *testing.T) {
664664
flow, _, _ := newValidFlow(t, flow.TypeBrowser,
665665
public.URL+verification.RouteInitBrowserFlow+"?"+url.Values{
666666
"return_to": {returnToURL},
667-
"login_challenge": {"any_valid_challenge"}}.Encode())
667+
"login_challenge": {"any_valid_challenge"},
668+
}.Encode())
668669

669670
body := fmt.Sprintf(
670671
`{"csrf_token":"%s","code":"%s"}`, flow.CSRFToken, "2475",

text/id.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,11 @@ const (
108108
)
109109

110110
const (
111-
InfoSelfServiceVerification ID = 1080000 + iota // 1080000
112-
InfoSelfServiceVerificationEmailSent // 1080001
113-
InfoSelfServiceVerificationSuccessful // 1080002
114-
InfoSelfServiceVerificationEmailWithCodeSent // 1080003
111+
InfoSelfServiceVerification ID = 1080000 + iota // 1080000
112+
InfoSelfServiceVerificationEmailSent // 1080001
113+
InfoSelfServiceVerificationSuccessful // 1080002
114+
InfoSelfServiceVerificationEmailWithCodeSent // 1080003
115+
InfoSelfServiceVerificationMessageWithCodeSent // 1080004
115116
)
116117

117118
const (

text/id_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ func TestIDs(t *testing.T) {
7676
assert.Equal(t, 1080001, int(InfoSelfServiceVerificationEmailSent))
7777
assert.Equal(t, 1080002, int(InfoSelfServiceVerificationSuccessful))
7878
assert.Equal(t, 1080003, int(InfoSelfServiceVerificationEmailWithCodeSent))
79+
assert.Equal(t, 1080004, int(InfoSelfServiceVerificationMessageWithCodeSent))
7980

8081
assert.Equal(t, 1070015, int(InfoNodeLabelCaptcha))
8182
assert.Equal(t, 4000038, int(ErrorValidationCaptchaError))

text/message_verification.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,10 @@ func NewErrorValidationVerificationCodeInvalidOrAlreadyUsed() *Message {
6868
}
6969
}
7070

71-
func NewVerificationEmailWithCodeSent() *Message {
71+
func NewVerificationMessageWithCodeSent() *Message {
7272
return &Message{
73-
ID: InfoSelfServiceVerificationEmailWithCodeSent,
73+
ID: InfoSelfServiceVerificationMessageWithCodeSent,
7474
Type: Info,
75-
Text: "An email containing a verification code has been sent to the email address you provided. If you have not received an email, check the spelling of the address and make sure to use the address you registered with.",
75+
Text: "A verification code has been sent to contact information you provided.",
7676
}
7777
}

0 commit comments

Comments
 (0)