feat(SW-360): Add signup verification route w. tracking for login
This commit is contained in:
committed by
Pontus Dreij
parent
0e0c09dfcd
commit
bf8976c24c
@@ -0,0 +1,26 @@
|
||||
import LoginButton from "@/components/Current/Header/LoginButton"
|
||||
import { getIntl } from "@/i18n"
|
||||
|
||||
import styles from "./signUpVerification.module.css"
|
||||
|
||||
import type { SignUpVerificationProps } from "@/types/components/blocks/dynamicContent"
|
||||
|
||||
export default async function SignUpVerification({
|
||||
title,
|
||||
subtitle,
|
||||
}: SignUpVerificationProps) {
|
||||
const intl = await getIntl()
|
||||
|
||||
return (
|
||||
<div className={styles.container}>
|
||||
<LoginButton
|
||||
className={styles.loginButton}
|
||||
trackingId="signUpVerificationLogin"
|
||||
position="sign up verification"
|
||||
variant="signupVerification"
|
||||
>
|
||||
{intl.formatMessage({ id: "Proceed to login" })}
|
||||
</LoginButton>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
.container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
margin-top: var(--Spacing-x3);
|
||||
}
|
||||
22
components/Blocks/DynamicContent/SignupFormWrapper/index.tsx
Normal file
22
components/Blocks/DynamicContent/SignupFormWrapper/index.tsx
Normal file
@@ -0,0 +1,22 @@
|
||||
import { redirect } from "next/navigation"
|
||||
|
||||
import { overview } from "@/constants/routes/myPages"
|
||||
|
||||
import { auth } from "@/auth"
|
||||
import Form from "@/components/Forms/Register"
|
||||
import { getLang } from "@/i18n/serverContext"
|
||||
|
||||
import type { RegisterFormProps } from "@/types/components/form/registerForm"
|
||||
|
||||
export default async function SignupFormWrapper({
|
||||
dynamic_content,
|
||||
}: {
|
||||
dynamic_content: RegisterFormProps
|
||||
}) {
|
||||
const session = await auth()
|
||||
if (session) {
|
||||
// We don't want to allow users to signup if they are already authenticated.
|
||||
redirect(overview[getLang()])
|
||||
}
|
||||
return <Form {...dynamic_content} />
|
||||
}
|
||||
@@ -7,10 +7,11 @@ import ExpiringPoints from "@/components/Blocks/DynamicContent/Points/ExpiringPo
|
||||
import PointsOverview from "@/components/Blocks/DynamicContent/Points/Overview"
|
||||
import CurrentRewardsBlock from "@/components/Blocks/DynamicContent/Rewards/CurrentLevel"
|
||||
import NextLevelRewardsBlock from "@/components/Blocks/DynamicContent/Rewards/NextLevel"
|
||||
import SignupFormWrapper from "@/components/Blocks/DynamicContent/SignupFormWrapper"
|
||||
import SignUpVerification from "@/components/Blocks/DynamicContent/SignUpVerification"
|
||||
import PreviousStays from "@/components/Blocks/DynamicContent/Stays/Previous"
|
||||
import SoonestStays from "@/components/Blocks/DynamicContent/Stays/Soonest"
|
||||
import UpcomingStays from "@/components/Blocks/DynamicContent/Stays/Upcoming"
|
||||
import ServerRegisterForm from "@/components/Forms/Register/ServerRegisterForm"
|
||||
|
||||
import type { DynamicContentProps } from "@/types/components/blocks/dynamicContent"
|
||||
import { DynamicContentEnum } from "@/types/enums/dynamicContent"
|
||||
@@ -53,7 +54,9 @@ export default async function DynamicContent({
|
||||
case DynamicContentEnum.Blocks.components.previous_stays:
|
||||
return <PreviousStays {...dynamic_content} />
|
||||
case DynamicContentEnum.Blocks.components.sign_up_form:
|
||||
return <ServerRegisterForm {...dynamic_content} />
|
||||
return <SignupFormWrapper dynamic_content={dynamic_content} />
|
||||
case DynamicContentEnum.Blocks.components.sign_up_verification:
|
||||
return <SignUpVerification {...dynamic_content} />
|
||||
case DynamicContentEnum.Blocks.components.soonest_stays:
|
||||
return <SoonestStays {...dynamic_content} />
|
||||
case DynamicContentEnum.Blocks.components.upcoming_stays:
|
||||
|
||||
Reference in New Issue
Block a user