Complete sermon itinerary application with Nuxt 3, SQLite, authentication, and Docker deployment

This commit is contained in:
2025-10-01 22:15:01 -04:00
parent dacaea6fa4
commit 1b282c05fe
26 changed files with 1245 additions and 0 deletions

23
server/utils/auth.ts Normal file
View File

@@ -0,0 +1,23 @@
import { H3Event } from 'h3'
export function setAuthCookie(event: H3Event, username: string) {
setCookie(event, 'auth', username, {
httpOnly: true,
secure: process.env.NODE_ENV === 'production',
maxAge: 60 * 60 * 24 * 7, // 7 days
path: '/'
})
}
export function getAuthCookie(event: H3Event) {
return getCookie(event, 'auth')
}
export function clearAuthCookie(event: H3Event) {
deleteCookie(event, 'auth')
}
export function isAuthenticated(event: H3Event): boolean {
const auth = getAuthCookie(event)
return !!auth
}