Skip to content

Commit 5da6792

Browse files
authored
fix(core,connector): add bind mfa verification code type (#7741)
1 parent dfefc8d commit 5da6792

File tree

5 files changed

+20
-2
lines changed

5 files changed

+20
-2
lines changed

.changeset/kind-cherries-yawn.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@logto/connector-kit": minor
3+
---
4+
5+
add bindMFA to template type

packages/connectors/connector-logto-email/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ const sendMessage =
4040
body: {
4141
data: {
4242
to,
43+
// @ts-expect-error TODO @wangsijie: remove this when @logto/cloud updates
4344
type,
4445
payload: {
4546
...payload,

packages/core/src/routes/experience/verification-routes/verification-code.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ export default function verificationCodeRoutes<T extends ExperienceInteractionRo
5858
libraries,
5959
queries,
6060
identifier,
61-
// If the interaction already identified a user, we are binding a new identifier
61+
// If the interaction already identified a user, we are binding a new MFA verification
6262
ctx.experienceInteraction.identifiedUserId
63-
? TemplateType.BindNewIdentifier
63+
? TemplateType.BindMfa
6464
: getTemplateTypeByEvent(interactionEvent)
6565
),
6666
libraries,

packages/integration-tests/src/__mocks__/connectors-mock.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,10 @@ export const mockSmsConnectorConfig = {
130130
usageType: 'MfaVerification',
131131
content: 'This is for MFA verification purposes only. Your passcode is {{code}}.',
132132
},
133+
{
134+
usageType: 'BindMfa',
135+
content: 'This is for binding MFA purposes only. Your passcode is {{code}}.',
136+
},
133137
],
134138
};
135139

@@ -193,6 +197,12 @@ export const mockEmailConnectorConfig = {
193197
subject: 'Logto MFA Verification Template',
194198
content: 'This is for MFA verification purposes only. Your passcode is {{code}}.',
195199
},
200+
{
201+
usageType: 'BindMfa',
202+
type: 'text/plain',
203+
subject: 'Logto Bind MFA Template',
204+
content: 'This is for binding MFA purposes only. Your passcode is {{code}}.',
205+
},
196206
],
197207
};
198208

packages/toolkit/connector-kit/src/types/passwordless.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ export enum TemplateType {
3636
BindNewIdentifier = 'BindNewIdentifier',
3737
/** The template for sending MFA verification code. */
3838
MfaVerification = 'MfaVerification',
39+
/** The template for binding MFA verification. */
40+
BindMfa = 'BindMfa',
3941
}
4042

4143
export const templateTypeGuard = z.nativeEnum(TemplateType);

0 commit comments

Comments
 (0)