feat: implement auth system, passkeys, and user management
Add PostgreSQL and Redis integration for users and sessions Implement password and WebAuthn passkey login flows Add Docker stack, super-admin seeding, and protected routes
This commit is contained in:
12
app/middleware/auth.ts
Normal file
12
app/middleware/auth.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
export default defineNuxtRouteMiddleware(async (to) => {
|
||||
const auth = useAuth()
|
||||
await auth.fetchSession()
|
||||
|
||||
if (!auth.user.value) {
|
||||
return navigateTo('/login')
|
||||
}
|
||||
|
||||
if (to.path !== '/security' && auth.needsOnboarding.value) {
|
||||
return navigateTo('/security')
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user