Translations for Email Notifications (#1278)

Co-authored-by: Niko Heller <hellerniko@gmail.com>
This commit is contained in:
Luke Vella 2024-09-02 19:30:58 +01:00 committed by GitHub
parent aa52a0f26f
commit f4218c3115
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
51 changed files with 1071 additions and 970 deletions

View file

@ -22,7 +22,7 @@ import { env } from "@/env";
import { absoluteUrl } from "@/utils/absolute-url";
import { CustomPrismaAdapter } from "@/utils/auth/custom-prisma-adapter";
import { mergeGuestsIntoUser } from "@/utils/auth/merge-user";
import { emailClient } from "@/utils/emails";
import { getEmailClient } from "@/utils/emails";
import { getValueByPath } from "@/utils/get-value-by-path";
const providers: Provider[] = [
@ -90,21 +90,23 @@ const providers: Provider[] = [
},
select: {
name: true,
locale: true,
},
});
if (user) {
await emailClient.sendTemplate("LoginEmail", {
to: email,
subject: `${token} is your 6-digit code`,
props: {
name: user.name,
magicLink: absoluteUrl("/auth/login", {
magicLink: url,
}),
code: token,
await getEmailClient(user.locale ?? undefined).sendTemplate(
"LoginEmail",
{
to: email,
props: {
magicLink: absoluteUrl("/auth/login", {
magicLink: url,
}),
code: token,
},
},
});
);
}
},
}),