task-5 fix: isRole, login redirect, create-user script per cliente e trainer
This commit is contained in:
+1
-1
@@ -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
@@ -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');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user