Files
myeasycms-v2/apps/web/app/update-password/page.tsx
giancarlo c121a3bdad Update "Password Reset" to "Update Password"
The code changes correspond to the rebranding of "Password Reset" to "Update Password". The names of components, functions, and routes have been updated to reflect this change. Also, a minor code optimization has been made in the i18n.server file for the creation of i18n server instances.
2024-04-19 17:27:11 +08:00

38 lines
1.1 KiB
TypeScript

import { redirect } from 'next/navigation';
import { UpdatePasswordForm } from '@kit/auth/password-reset';
import { AuthLayoutShell } from '@kit/auth/shared';
import { requireUser } from '@kit/supabase/require-user';
import { getSupabaseServerComponentClient } from '@kit/supabase/server-component-client';
import { AppLogo } from '~/components/app-logo';
import pathsConfig from '~/config/paths.config';
import { createI18nServerInstance } from '~/lib/i18n/i18n.server';
import { withI18n } from '~/lib/i18n/with-i18n';
export const generateMetadata = async () => {
const { t } = await createI18nServerInstance();
return {
title: t('auth.updatePassword'),
};
};
async function UpdatePasswordPage() {
const client = getSupabaseServerComponentClient();
const auth = await requireUser(client);
// we require the user to be logged in to access this page
if (auth.error) {
redirect(auth.redirectTo);
}
return (
<AuthLayoutShell Logo={AppLogo}>
<UpdatePasswordForm redirectTo={pathsConfig.app.home} />
</AuthLayoutShell>
);
}
export default withI18n(UpdatePasswordPage);