final user account polish
This commit is contained in:
parent
86fdd403b0
commit
aba6727306
3 changed files with 34 additions and 34 deletions
|
|
@ -3,21 +3,24 @@ import { cookies } from "next/headers";
|
|||
import { redirect } from "next/navigation";
|
||||
import SignIn from "./sign-in";
|
||||
|
||||
export default async function SignInPage(
|
||||
props: { searchParams: Promise<Record<string, string | string[] | undefined>> }
|
||||
) {
|
||||
const sp = await props.searchParams;
|
||||
export default async function SignInPage({
|
||||
searchParams,
|
||||
}: {
|
||||
searchParams?: Record<string, string | string[] | undefined>;
|
||||
}) {
|
||||
const sp = searchParams ?? {};
|
||||
|
||||
const nextParam = Array.isArray(sp.next) ? sp.next[0] : sp.next;
|
||||
const nextPath = nextParam && nextParam.startsWith("/") ? nextParam : "/portal";
|
||||
const nextPath =
|
||||
nextParam && String(nextParam).startsWith("/") ? String(nextParam) : "/portal";
|
||||
|
||||
const reauthParam = Array.isArray(sp.reauth) ? sp.reauth[0] : sp.reauth;
|
||||
const forceParam = Array.isArray(sp.force) ? sp.force[0] : sp.force;
|
||||
const forceParam = Array.isArray(sp.force) ? sp.force[0] : sp.force;
|
||||
const reauth = reauthParam === "1" || forceParam === "1";
|
||||
|
||||
// If reauth is requested, always render the form (no redirect).
|
||||
if (!reauth) {
|
||||
const at = (await cookies()).get("ma_at")?.value;
|
||||
const at = cookies().get("ma_at")?.value;
|
||||
if (at) redirect("/portal");
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue