Skip to content

Commit 718a142

Browse files
authored
refactor(core): conditionally pass uiLocales param to email templates (#7826)
1 parent 5101741 commit 718a142

File tree

4 files changed

+7
-4
lines changed

4 files changed

+7
-4
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export default function verificationCodeRoutes<T extends AuthedMeRouter>(
3535
const { uiLocales } = getLogtoCookie(ctx);
3636
await sendPasscode(code, {
3737
locale: ctx.locale,
38-
uiLocales,
38+
...(uiLocales && { uiLocales }),
3939
});
4040

4141
ctx.status = 204;

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,12 @@ export const sendCode = async ({
108108
identifier
109109
);
110110

111+
const { uiLocales } = getLogtoCookie(ctx);
112+
111113
// Send verification code
112114
await codeVerification.sendVerificationCode({
113115
locale: ctx.locale,
114-
uiLocales: getLogtoCookie(ctx).uiLocales,
116+
...(uiLocales && { uiLocales }),
115117
...templateContext,
116118
});
117119

packages/core/src/routes/interaction/additional.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,13 +123,14 @@ export default function additionalRoutes<T extends IRouterParamContext>(
123123
const { event } = getInteractionStorage(interactionDetails.result);
124124

125125
const messageContext = await buildVerificationCodeTemplateContext(passcodes, ctx, guard.body);
126+
const { uiLocales } = getLogtoCookie(ctx);
126127

127128
await sendVerificationCodeToIdentifier(
128129
{
129130
event,
130131
...guard.body,
131132
locale: ctx.locale,
132-
uiLocales: getLogtoCookie(ctx).uiLocales,
133+
...(uiLocales && { uiLocales }),
133134
messageContext,
134135
},
135136
interactionDetails.jti,

packages/core/src/routes/verification/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ export default function verificationRoutes<T extends UserRouter>(
123123

124124
await codeVerification.sendVerificationCode({
125125
locale: ctx.locale,
126-
uiLocales,
126+
...(uiLocales && { uiLocales }),
127127
...emailContextPayload,
128128
});
129129

0 commit comments

Comments
 (0)