- Updated test components (`PasswordResetConfirmForm`, `PasswordChangeForm`) to use i18n keys directly, ensuring accurate validation messages. - Refined translations in `it.json` to standardize format and content. - Replaced text-based labels with localized strings in `PasswordResetRequestForm` and `RegisterForm`. - Introduced `generateLocalizedMetadata` utility and updated layout metadata generation for locale-aware SEO. - Enhanced e2e tests with locale-prefixed routes and updated assertions for consistency. - Added comprehensive i18n documentation (`I18N.md`) for usage, architecture, and testing.
53 lines
1.5 KiB
TypeScript
53 lines
1.5 KiB
TypeScript
/**
|
|
* Password Reset Request Page
|
|
* Users enter their email to receive reset instructions
|
|
*/
|
|
|
|
import { Metadata } from 'next';
|
|
import dynamic from 'next/dynamic';
|
|
import { generatePageMetadata, type Locale } from '@/lib/i18n/metadata';
|
|
import { getTranslations } from 'next-intl/server';
|
|
|
|
// Code-split PasswordResetRequestForm
|
|
const PasswordResetRequestForm = dynamic(
|
|
/* istanbul ignore next - Next.js dynamic import, tested via component */
|
|
() =>
|
|
import('@/components/auth/PasswordResetRequestForm').then((mod) => ({
|
|
default: mod.PasswordResetRequestForm,
|
|
})),
|
|
{
|
|
loading: () => (
|
|
<div className="space-y-4">
|
|
<div className="animate-pulse h-10 bg-muted rounded" />
|
|
<div className="animate-pulse h-10 bg-primary/20 rounded" />
|
|
</div>
|
|
),
|
|
}
|
|
);
|
|
|
|
export async function generateMetadata({
|
|
params,
|
|
}: {
|
|
params: Promise<{ locale: string }>;
|
|
}): Promise<Metadata> {
|
|
const { locale } = await params;
|
|
const t = await getTranslations({ locale, namespace: 'auth.passwordReset' });
|
|
|
|
return generatePageMetadata(locale as Locale, t('title'), t('subtitle'), '/password-reset');
|
|
}
|
|
|
|
export default function PasswordResetPage() {
|
|
return (
|
|
<div className="space-y-6">
|
|
<div className="text-center">
|
|
<h2 className="text-3xl font-bold tracking-tight">Reset your password</h2>
|
|
<p className="mt-2 text-muted-foreground">
|
|
We'll send you an email with instructions to reset your password
|
|
</p>
|
|
</div>
|
|
|
|
<PasswordResetRequestForm showLoginLink />
|
|
</div>
|
|
);
|
|
}
|