
* feat: add crowdin and supported languages * fix: main branch name * feat: test crowdin integration * feat: add crowdin config skeleton * feat: update crowdin.yml * fix: remove ro translation * test: en translation * test: en translation * New Crowdin translations by Github Action (#735) Co-authored-by: Crowdin Bot <support+bot@crowdin.com> * test: en translation * fix: separate upload/download workflows * wip * New Crowdin translations by Github Action (#738) Co-authored-by: Crowdin Bot <support+bot@crowdin.com> * wip * wip * wip * wip * wip * typo * wip * wip * update crowdin config * update * chore: support i18n de,es,fr,it,pt,ru,ro,en * chore: extract i18n strings * chore: extract booking components strings for i18n * wip * extract more strings * wip * fallback to getServerSideProps for now * New Crowdin translations by Github Action (#874) Co-authored-by: Crowdin Bot <support+bot@crowdin.com> * fix: minor fixes on the datepicker * fix: add dutch lang * fix: linting issues * fix: string * fix: update GHA * cleanup trpc * fix linting Co-authored-by: Peer Richelsen <peeroke@gmail.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Crowdin Bot <support+bot@crowdin.com> Co-authored-by: Bailey Pumfleet <pumfleet@hey.com>
55 lines
1.6 KiB
TypeScript
55 lines
1.6 KiB
TypeScript
import { serverSideTranslations } from "next-i18next/serverSideTranslations";
|
|
import React from "react";
|
|
|
|
import { getSession } from "@lib/auth";
|
|
import { getOrSetUserLocaleFromHeaders } from "@lib/core/i18n/i18n.utils";
|
|
import { useLocale } from "@lib/hooks/useLocale";
|
|
import prisma from "@lib/prisma";
|
|
|
|
import SettingsShell from "@components/SettingsShell";
|
|
import Shell from "@components/Shell";
|
|
import ChangePasswordSection from "@components/security/ChangePasswordSection";
|
|
import TwoFactorAuthSection from "@components/security/TwoFactorAuthSection";
|
|
|
|
export default function Security({ user, localeProp }) {
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
const { locale, t } = useLocale({ localeProp });
|
|
return (
|
|
<Shell heading={t("security")} subtitle={t("manage_account_security")}>
|
|
<SettingsShell>
|
|
<ChangePasswordSection localeProp={locale} />
|
|
<TwoFactorAuthSection localeProp={locale} twoFactorEnabled={user.twoFactorEnabled} />
|
|
</SettingsShell>
|
|
</Shell>
|
|
);
|
|
}
|
|
|
|
export async function getServerSideProps(context) {
|
|
const session = await getSession(context);
|
|
const locale = await getOrSetUserLocaleFromHeaders(context.req);
|
|
|
|
if (!session?.user?.id) {
|
|
return { redirect: { permanent: false, destination: "/auth/login" } };
|
|
}
|
|
|
|
const user = await prisma.user.findFirst({
|
|
where: {
|
|
id: session.user.id,
|
|
},
|
|
select: {
|
|
id: true,
|
|
username: true,
|
|
name: true,
|
|
twoFactorEnabled: true,
|
|
},
|
|
});
|
|
|
|
return {
|
|
props: {
|
|
localeProp: locale,
|
|
session,
|
|
user,
|
|
...(await serverSideTranslations(locale, ["common"])),
|
|
},
|
|
};
|
|
}
|