task-5 fix: isRole, login redirect, create-user script per cliente e trainer

This commit is contained in:
2026-08-21 19:53:12 +02:00
parent 473c0d8c36
commit d3abbf9bf7
4 changed files with 30 additions and 5 deletions
+1 -1
View File
@@ -118,7 +118,7 @@ export function randomPassword(): string {
}
export function isRole(v: unknown): v is Role {
return v === 'admin' || v === 'superuser' || v === 'user' || v === 'piattaforme';
return v === 'admin' || v === 'superuser' || v === 'user' || v === 'piattaforme' || v === 'cliente' || v === 'trainer';
}
export function landingFor(role: string): string {
+1 -1
View File
@@ -16,7 +16,7 @@ export const onRequest = defineMiddleware((context, next) => {
}
// Le piattaforme riservate si raggiungono dal sito, quindi passano dal login
// pubblico e ci tornano dopo l'accesso; il pannello ha il proprio.
if (pathname.startsWith('/campus') || pathname.startsWith('/piattaforme'))
if (pathname.startsWith('/campus') || pathname.startsWith('/piattaforme') || pathname.startsWith('/longevity'))
return context.redirect(`/login?next=${encodeURIComponent(pathname)}`);
return context.redirect('/admin/login');
}