From d65be1845ac3237d15424a5883604365e9be29ee Mon Sep 17 00:00:00 2001 From: Chuma McPhoy Date: Fri, 15 Nov 2024 12:57:32 +0100 Subject: [PATCH] fix(SW-890): more reliable checking of user --- .../Blocks/DynamicContent/SignUpVerification/index.tsx | 6 +++--- .../Blocks/DynamicContent/SignupFormWrapper/index.tsx | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/components/Blocks/DynamicContent/SignUpVerification/index.tsx b/components/Blocks/DynamicContent/SignUpVerification/index.tsx index 2b182d4bf..4ae9fd899 100644 --- a/components/Blocks/DynamicContent/SignUpVerification/index.tsx +++ b/components/Blocks/DynamicContent/SignUpVerification/index.tsx @@ -1,8 +1,8 @@ import { redirect } from "next/navigation" import { overview } from "@/constants/routes/myPages" +import { getProfileSafely } from "@/lib/trpc/memoizedRequests" -import { auth } from "@/auth" import LoginButton from "@/components/LoginButton" import { getIntl } from "@/i18n" import { getLang } from "@/i18n/serverContext" @@ -14,8 +14,8 @@ import type { SignUpVerificationProps } from "@/types/components/blocks/dynamicC export default async function SignUpVerification({ dynamic_content, }: SignUpVerificationProps) { - const session = await auth() - if (session) { + const user = await getProfileSafely() + if (user) { redirect(overview[getLang()]) } const intl = await getIntl() diff --git a/components/Blocks/DynamicContent/SignupFormWrapper/index.tsx b/components/Blocks/DynamicContent/SignupFormWrapper/index.tsx index bf6af6294..7daf85588 100644 --- a/components/Blocks/DynamicContent/SignupFormWrapper/index.tsx +++ b/components/Blocks/DynamicContent/SignupFormWrapper/index.tsx @@ -1,8 +1,8 @@ import { redirect } from "next/navigation" import { overview } from "@/constants/routes/myPages" +import { getProfileSafely } from "@/lib/trpc/memoizedRequests" -import { auth } from "@/auth" import SignupForm from "@/components/Forms/Signup" import { getLang } from "@/i18n/serverContext" @@ -11,8 +11,8 @@ import { SignupFormWrapperProps } from "@/types/components/blocks/dynamicContent export default async function SignupFormWrapper({ dynamic_content, }: SignupFormWrapperProps) { - const session = await auth() - if (session) { + const user = await getProfileSafely() + if (user) { // We don't want to allow users to access signup if they are already authenticated. redirect(overview[getLang()]) }