feat: add notes app

This commit is contained in:
2026-10-01 19:39:20 +02:00
parent ccb8dd3d15
commit ddbb6f37b5
35 changed files with 706 additions and 52 deletions
+20
View File
@@ -0,0 +1,20 @@
import { z } from 'zod'
const FAILED_LOGIN_DELAY_MS = 1000
const loginSchema = z.object({
password: z.string().min(1)
})
export default defineEventHandler(async (event) => {
const { password } = await readValidBody(event, loginSchema)
if (!(await passwordMatches(event, password))) {
await new Promise(resolve => setTimeout(resolve, FAILED_LOGIN_DELAY_MS))
throw createError({ statusCode: 401, statusMessage: 'Wrong password' })
}
const session = await authSession(event)
await session.update({ unlocked: true })
return { unlocked: true }
})