Spend login, invite, and email-change links only after a confirm POST so mail scanners cannot use them up.
GET still shows a one-button page, a used invitation can resend or reopen for the signed-in invitee, and an email-change GET no longer signs the account out.
This commit is contained in:
1 parent
600056499c
commit
a725cf1a32
33 files changed
+1002
-89
No files matched your search
@@ -0,0 +1,49 @@
|
||||
"use client";
|
||||
|
||||
import { Suspense } from "react";
|
||||
import { useSearchParams } from "next/navigation";
|
||||
import { useTranslation } from "../../../contexts/MessagesContext";
|
||||
import { emailChangeVerifyPath } from "../../../../lib/create/confirmLinkPaths";
|
||||
import { ConfirmLinkScreen } from "../../_components/ConfirmLinkScreen";
|
||||
|
||||
function EmailChangeConfirmFallback() {
|
||||
const t = useTranslation("pages.profile");
|
||||
return (
|
||||
<div className="flex min-h-[100dvh] items-center justify-center bg-[var(--color-surface-invert-brand-primary)]">
|
||||
<p className="text-[14px] text-[var(--color-content-default-primary)]">
|
||||
{t("loading")}
|
||||
</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function EmailChangeConfirmWithParams() {
|
||||
const t = useTranslation("pages.profile");
|
||||
const tLogin = useTranslation("pages.login");
|
||||
const searchParams = useSearchParams();
|
||||
const token = searchParams.get("token") ?? "";
|
||||
|
||||
return (
|
||||
<ConfirmLinkScreen
|
||||
title={t("emailChangeConfirmTitle")}
|
||||
description={t("emailChangeConfirmDescription")}
|
||||
buttonLabel={t("emailChangeConfirmButton")}
|
||||
action={emailChangeVerifyPath(token)}
|
||||
token={token}
|
||||
backHref="/"
|
||||
backLabel={tLogin("backToHome")}
|
||||
missingTitle={t("emailChangeConfirmMissingTitle")}
|
||||
missingDescription={t("emailChangeConfirmMissingDescription")}
|
||||
missingHref="/profile"
|
||||
missingButtonLabel={t("emailChangeConfirmMissingButton")}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
export default function EmailChangeConfirmPage() {
|
||||
return (
|
||||
<Suspense fallback={<EmailChangeConfirmFallback />}>
|
||||
<EmailChangeConfirmWithParams />
|
||||
</Suspense>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user