mirror of
https://github.com/formbricks/formbricks.git
synced 2026-02-22 00:52:50 -06:00
Co-authored-by: Piyush Gupta <piyushguptaa2z123@gmail.com> Co-authored-by: Piyush Gupta <56182734+gupta-piyush19@users.noreply.github.com> Co-authored-by: Victor Hugo dos Santos <115753265+victorvhs017@users.noreply.github.com> Co-authored-by: pandeymangg <anshuman.pandey9999@gmail.com> Co-authored-by: Matti Nannt <matti@formbricks.com> Co-authored-by: Matti Nannt <mail@matthiasnannt.com> Co-authored-by: Johannes <johannes@formbricks.com> Co-authored-by: Johannes <72809645+jobenjada@users.noreply.github.com>
49 lines
1.8 KiB
TypeScript
49 lines
1.8 KiB
TypeScript
import { logger } from "@formbricks/logger";
|
|
import { ZUserEmail } from "@formbricks/types/user";
|
|
import { getEmailFromEmailToken } from "@/lib/jwt";
|
|
import { getTranslate } from "@/lingodotdev/server";
|
|
import { FormWrapper } from "@/modules/auth/components/form-wrapper";
|
|
import { RequestVerificationEmail } from "@/modules/auth/verification-requested/components/request-verification-email";
|
|
import { VerificationMessage } from "@/modules/auth/verification-requested/components/verification-message";
|
|
|
|
export const VerificationRequestedPage = async ({ searchParams }) => {
|
|
const t = await getTranslate();
|
|
const { token } = await searchParams;
|
|
try {
|
|
const email = getEmailFromEmailToken(token);
|
|
const parsedEmail = ZUserEmail.safeParse(email);
|
|
if (parsedEmail.success) {
|
|
return (
|
|
<FormWrapper>
|
|
<>
|
|
<h1 className="leading-2 mb-4 text-center text-lg font-semibold text-slate-900">
|
|
{t("auth.verification-requested.please_confirm_your_email_address")}
|
|
</h1>
|
|
<VerificationMessage email={email} />
|
|
<hr className="my-4" />
|
|
<p className="text-center text-xs text-slate-500">
|
|
{t("auth.verification-requested.you_didnt_receive_an_email_or_your_link_expired")}
|
|
</p>
|
|
<div className="mt-5">
|
|
<RequestVerificationEmail email={email.toLowerCase()} />
|
|
</div>
|
|
</>
|
|
</FormWrapper>
|
|
);
|
|
} else {
|
|
return (
|
|
<FormWrapper>
|
|
<p className="text-center">{t("auth.verification-requested.invalid_email_address")}</p>
|
|
</FormWrapper>
|
|
);
|
|
}
|
|
} catch (error) {
|
|
logger.error(error, "Invalid token");
|
|
return (
|
|
<FormWrapper>
|
|
<p className="text-center">{t("auth.verification-requested.invalid_token")}</p>
|
|
</FormWrapper>
|
|
);
|
|
}
|
|
};
|