mirror of
https://github.com/fosrl/pangolin.git
synced 2026-03-07 11:16:37 +00:00
This improves the user experience by automatically filling the email field
and preventing users from changing the email they were invited with. - Update invite link generation to include email parameter in URL - Modify signup form to pre-fill and lock email field when provided via invite - Update invite page and status card to preserve email through redirect chain - Ensure existing invite URLs continue to work without breaking changes
This commit is contained in:
@@ -14,6 +14,7 @@ export default async function InvitePage(props: {
|
||||
const params = await props.searchParams;
|
||||
|
||||
const tokenParam = params.token as string;
|
||||
const emailParam = params.email as string;
|
||||
|
||||
if (!tokenParam) {
|
||||
redirect("/");
|
||||
@@ -70,16 +71,22 @@ export default async function InvitePage(props: {
|
||||
const type = cardType();
|
||||
|
||||
if (!user && type === "user_does_not_exist") {
|
||||
redirect(`/auth/signup?redirect=/invite?token=${params.token}`);
|
||||
const redirectUrl = emailParam
|
||||
? `/auth/signup?redirect=/invite?token=${params.token}&email=${encodeURIComponent(emailParam)}`
|
||||
: `/auth/signup?redirect=/invite?token=${params.token}`;
|
||||
redirect(redirectUrl);
|
||||
}
|
||||
|
||||
if (!user && type === "not_logged_in") {
|
||||
redirect(`/auth/login?redirect=/invite?token=${params.token}`);
|
||||
const redirectUrl = emailParam
|
||||
? `/auth/login?redirect=/invite?token=${params.token}&email=${encodeURIComponent(emailParam)}`
|
||||
: `/auth/login?redirect=/invite?token=${params.token}`;
|
||||
redirect(redirectUrl);
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<InviteStatusCard type={type} token={tokenParam} />
|
||||
<InviteStatusCard type={type} token={tokenParam} email={emailParam} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user