fix(SW-890): more reliable checking of user
This commit is contained in:
@@ -1,8 +1,8 @@
|
|||||||
import { redirect } from "next/navigation"
|
import { redirect } from "next/navigation"
|
||||||
|
|
||||||
import { overview } from "@/constants/routes/myPages"
|
import { overview } from "@/constants/routes/myPages"
|
||||||
|
import { getProfileSafely } from "@/lib/trpc/memoizedRequests"
|
||||||
|
|
||||||
import { auth } from "@/auth"
|
|
||||||
import LoginButton from "@/components/LoginButton"
|
import LoginButton from "@/components/LoginButton"
|
||||||
import { getIntl } from "@/i18n"
|
import { getIntl } from "@/i18n"
|
||||||
import { getLang } from "@/i18n/serverContext"
|
import { getLang } from "@/i18n/serverContext"
|
||||||
@@ -14,8 +14,8 @@ import type { SignUpVerificationProps } from "@/types/components/blocks/dynamicC
|
|||||||
export default async function SignUpVerification({
|
export default async function SignUpVerification({
|
||||||
dynamic_content,
|
dynamic_content,
|
||||||
}: SignUpVerificationProps) {
|
}: SignUpVerificationProps) {
|
||||||
const session = await auth()
|
const user = await getProfileSafely()
|
||||||
if (session) {
|
if (user) {
|
||||||
redirect(overview[getLang()])
|
redirect(overview[getLang()])
|
||||||
}
|
}
|
||||||
const intl = await getIntl()
|
const intl = await getIntl()
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { redirect } from "next/navigation"
|
import { redirect } from "next/navigation"
|
||||||
|
|
||||||
import { overview } from "@/constants/routes/myPages"
|
import { overview } from "@/constants/routes/myPages"
|
||||||
|
import { getProfileSafely } from "@/lib/trpc/memoizedRequests"
|
||||||
|
|
||||||
import { auth } from "@/auth"
|
|
||||||
import SignupForm from "@/components/Forms/Signup"
|
import SignupForm from "@/components/Forms/Signup"
|
||||||
import { getLang } from "@/i18n/serverContext"
|
import { getLang } from "@/i18n/serverContext"
|
||||||
|
|
||||||
@@ -11,8 +11,8 @@ import { SignupFormWrapperProps } from "@/types/components/blocks/dynamicContent
|
|||||||
export default async function SignupFormWrapper({
|
export default async function SignupFormWrapper({
|
||||||
dynamic_content,
|
dynamic_content,
|
||||||
}: SignupFormWrapperProps) {
|
}: SignupFormWrapperProps) {
|
||||||
const session = await auth()
|
const user = await getProfileSafely()
|
||||||
if (session) {
|
if (user) {
|
||||||
// We don't want to allow users to access signup if they are already authenticated.
|
// We don't want to allow users to access signup if they are already authenticated.
|
||||||
redirect(overview[getLang()])
|
redirect(overview[getLang()])
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user