feat(login): pagina pubblica /login con next sicuro

This commit is contained in:
2026-07-05 21:59:50 +02:00
parent 5ce10da9bd
commit 6b85872515
3 changed files with 78 additions and 0 deletions
+7
View File
@@ -0,0 +1,7 @@
// Path interno sicuro per il redirect post-login: deve iniziare con "/", non essere
// protocol-relative ("//"), non puntare alle API. Tutto il resto → home.
export function safeNext(next: string | null): string {
if (!next || !next.startsWith('/') || next.startsWith('//')) return '/';
if (next.startsWith('/api/')) return '/';
return next;
}