sign in and register fixes for looped and forwarded pages
This commit is contained in:
parent
5257a0d2fe
commit
ffccff85d4
6 changed files with 68 additions and 20 deletions
|
|
@ -83,6 +83,11 @@ import { NextResponse, NextRequest } from "next/server";
|
|||
const url = req.nextUrl.clone();
|
||||
const { pathname } = url;
|
||||
|
||||
// ── 0) Absolute rule: the homepage must never redirect (no mapping, no gating).
|
||||
if (pathname === "/") {
|
||||
return NextResponse.next();
|
||||
}
|
||||
|
||||
// ── 1) Legacy → Portal / Canonical mapping (runs before auth gating)
|
||||
const mapped = legacyMap(pathname);
|
||||
if (mapped && !isSameUrl(req, mapped)) {
|
||||
|
|
@ -174,8 +179,8 @@ import { NextResponse, NextRequest } from "next/server";
|
|||
type MapResult = { pathname: string; query?: Record<string, string> };
|
||||
|
||||
function legacyMap(pathname: string): MapResult | null {
|
||||
// If we’re already inside the portal, don’t try to remap again.
|
||||
if (pathname.startsWith("/portal")) return null;
|
||||
// Never map the homepage, and if we’re already inside the portal, don’t remap again.
|
||||
if (pathname === "/" || pathname.startsWith("/portal")) return null;
|
||||
|
||||
// 1) DETAIL PAGES: map legacy detail URLs straight into the portal with ?id=
|
||||
// NOTE: We intentionally DO NOT remap `/lasers/:id` and `/projects/:id`
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue