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:
adilallo committed 2026-11-22 16:58:30 -07:00
1 parent 600056499c
commit a725cf1a32
33 files changed
+1002 -89

No files matched your search

+39
View File
@@ -0,0 +1,39 @@
import { INVITE_COPY_QUERY, INVITE_COPY_VALUE } from "./invitePaths";
export function magicLinkConfirmPath(token: string): string {
return `/login/confirm?token=${encodeURIComponent(token)}`;
}
export function magicLinkVerifyPath(token: string): string {
return `/api/auth/magic-link/verify?token=${encodeURIComponent(token)}`;
}
export function inviteConfirmPath(
token: string,
opts?: { copy?: boolean },
): string {
const params = new URLSearchParams({ token });
if (opts?.copy) {
params.set(INVITE_COPY_QUERY, INVITE_COPY_VALUE);
}
return `/invite/confirm?${params.toString()}`;
}
export function inviteVerifyPath(
token: string,
opts?: { copy?: boolean },
): string {
const params = new URLSearchParams({ token });
if (opts?.copy) {
params.set(INVITE_COPY_QUERY, INVITE_COPY_VALUE);
}
return `/api/invites/rule-stakeholder/verify?${params.toString()}`;
}
export function emailChangeConfirmPath(token: string): string {
return `/email-change/confirm?token=${encodeURIComponent(token)}`;
}
export function emailChangeVerifyPath(token: string): string {
return `/api/user/email-change/verify?token=${encodeURIComponent(token)}`;
}