Skip to content

Commit d12e53d

Browse files
committedMar 7, 2025
Update email text
1 parent e1756d9 commit d12e53d

File tree

2 files changed

+22
-7
lines changed

2 files changed

+22
-7
lines changed
 

‎server/src/methods/sendEmailCode.ts

+13-3
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export const handler = async (
3636
let { code, existingUser, firstName } = await getLoginCode(email)
3737

3838
// send code to email
39-
await sendEmailCode(email, code, firstName)
39+
await sendEmailCode(email, code, firstName, existingUser)
4040

4141
return { existingUser }
4242
} catch (error) {
@@ -92,6 +92,16 @@ const getLoginCode = async (
9292
return { code, existingUser, firstName }
9393
}
9494

95-
const sendEmailCode = async (email: string, code: string, firstName: string | undefined) => {
96-
await sendEmail({ to: email, content: { template: "code", variables: { code, firstName } } })
95+
const sendEmailCode = async (email: string, code: string, firstName: string | undefined, existingUser: boolean) => {
96+
await sendEmail({
97+
to: email,
98+
content: {
99+
template: "code",
100+
variables: {
101+
code,
102+
firstName,
103+
isExistingUser: existingUser,
104+
},
105+
},
106+
})
97107
}

‎server/src/utils/email.ts

+9-4
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,19 @@ const getTemplate = (content: SendEmailContent): TextTemplate => {
8686

8787
interface CodeTemplateInput extends TemplateInput {
8888
template: "code"
89-
variables: { code: string; firstName: string | undefined }
89+
variables: {
90+
code: string;
91+
firstName: string | undefined;
92+
isExistingUser: boolean;
93+
}
9094
}
91-
function CodeTemplate({ code, firstName }: CodeTemplateInput["variables"]): TextTemplate {
92-
const subject = `Your Inline code: ${code}`
95+
function CodeTemplate({ code, firstName, isExistingUser }: CodeTemplateInput["variables"]): TextTemplate {
96+
const codeType = isExistingUser ? "login" : "signup"
97+
const subject = `Your Inline ${codeType} code: ${code}`
9398
const text = `
9499
Hey ${firstName ? `${firstName},` : "–"}
95100
96-
Here's your verification code for Inline: ${code}
101+
Here's your verification code for Inline ${codeType}: ${code}
97102
98103
Inline Team
99104
`.trim()

0 commit comments

Comments
 (0)