sign in and register fixes for looped and forwarded pages

This commit is contained in:
makearmy 2025-10-02 14:21:12 -04:00
parent 5257a0d2fe
commit ffccff85d4
6 changed files with 68 additions and 20 deletions

View file

@ -2,6 +2,7 @@
import { cookies } from "next/headers";
import { redirect } from "next/navigation";
import SignUp from "./sign-up";
import { isJwtValid } from "@/lib/jwt";
export default async function SignUpPage({
searchParams,
@ -10,7 +11,7 @@ export default async function SignUpPage({
}) {
const ck = await cookies();
const at = ck.get("ma_at")?.value;
if (at) redirect("/portal");
if (isJwtValid(at)) redirect("/portal");
const sp = searchParams ?? {};
const nextParam = Array.isArray(sp.next) ? sp.next[0] : sp.next;