feat: frontend alumnos sam-pruebas (RUT+clave, rendir y mis resultados)

This commit is contained in:
Nurfog committed 2026-09-28 10:58:45 -03:00
commit e6d283e184
26 files changed
+2555

No files matched your search

+23
View File
@@ -0,0 +1,23 @@
import { NextResponse } from "next/server";
import type { NextRequest } from "next/server";
const COOKIE = "sam_pruebas_alumno";
// Rutas que no requieren sesión.
const PUBLICAS = ["/login"];
export function middleware(req: NextRequest) {
const { pathname } = req.nextUrl;
if (pathname.startsWith("/api/")) return NextResponse.next();
if (PUBLICAS.some((p) => pathname === p || pathname.startsWith(p + "/"))) return NextResponse.next();
if (!req.cookies.get(COOKIE)) {
const url = req.nextUrl.clone();
url.pathname = "/login";
url.searchParams.set("next", pathname);
return NextResponse.redirect(url);
}
return NextResponse.next();
}
export const config = {
matcher: ["/((?!_next/static|_next/image|favicon.png|logo-sam.png|.*\\.svg).*)"]
};