Scheduling infrastructure for absolutely everyone.
fix: Use user locale for sending password resets (#10104)
Alex van Andel3009f17cb0e7
diff --git a/apps/web/pages/api/auth/forgot-password.ts b/apps/web/pages/api/auth/forgot-password.tsindex 58cb92ef4e0..1125a49678e 100644--- a/apps/web/pages/api/auth/forgot-password.ts+++ b/apps/web/pages/api/auth/forgot-password.ts@@ -11,8 +11,6 @@ import { getTranslation } from "@calcom/lib/server/i18n";import prisma from "@calcom/prisma";async function handler(req: NextApiRequest, res: NextApiResponse) {- const t = await getTranslation(req.body.language ?? "en", "common");-const email = z.string().email()@@ -47,6 +45,7 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {name: true,identityProvider: true,email: true,+ locale: true,},});@@ -57,6 +56,8 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {.json({ message: "If this email exists in our system, you should receive a Reset email." });}+ const t = await getTranslation(maybeUser.locale ?? "en", "common");+const maybePreviousRequest = await prisma.resetPasswordRequest.findMany({where: {email: maybeUser.email,diff --git a/apps/web/pages/auth/forgot-password/index.tsx b/apps/web/pages/auth/forgot-password/index.tsxindex 9cb5052000a..2c7fbbc2be2 100644--- a/apps/web/pages/auth/forgot-password/index.tsx+++ b/apps/web/pages/auth/forgot-password/index.tsx@@ -15,7 +15,7 @@ import PageWrapper from "@components/PageWrapper";import AuthContainer from "@components/ui/AuthContainer";export default function ForgotPassword({ csrfToken }: { csrfToken: string }) {- const { t, i18n } = useLocale();+ const { t } = useLocale();const [loading, setLoading] = React.useState(false);const [error, setError] = React.useState<{ message: string } | null>(null);const [success, setSuccess] = React.useState(false);@@ -31,7 +31,7 @@ export default function ForgotPassword({ csrfToken }: { csrfToken: string }) {try {const res = await fetch("/api/auth/forgot-password", {method: "POST",- body: JSON.stringify({ email: email, language: i18n.language }),+ body: JSON.stringify({ email }),headers: {"Content-Type": "application/json",},