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

View File

@@ -0,0 +1,30 @@
import { getUserByUsername } from '~/server/utils/database'
import { setAuthCookie } from '~/server/utils/auth'
export default defineEventHandler(async (event) => {
const body = await readBody(event)
const { username, password } = body
if (!username || !password) {
throw createError({
statusCode: 400,
message: 'Username and password are required'
})
}
const user = getUserByUsername(username)
if (!user || user.password !== password) {
throw createError({
statusCode: 401,
message: 'Invalid credentials'
})
}
setAuthCookie(event, username)
return {
success: true,
username: user.username
}
})