app-template/app/web/src/pages/[locale]/auth/forgot-password.astro

20 lines
582 B
Plaintext

---
import { COOKIE_LANG, isLocale, localePath, resolvePreferredLocale, type Locale } from "@app/i18n";
import AuthView from "~/views/auth.astro";
const raw = Astro.params["locale"];
const normalized = raw === "zh-cn" ? "zh-CN" : raw;
if (!normalized || !isLocale(normalized)) {
const preferred = resolvePreferredLocale(
Astro.cookies.get(COOKIE_LANG)?.value,
Astro.request.headers.get("accept-language"),
);
return Astro.redirect(localePath(preferred, "/auth/forgot-password"));
}
const locale: Locale = normalized;
---
<AuthView locale={locale} mode="forgot" />