api/app/validators/auth.ts
2025-08-26 00:26:11 +02:00

54 lines
1.1 KiB
TypeScript

import vine from '@vinejs/vine'
export const requestLoginValidator = vine.compile(
vine.object({
email: vine
.string()
.email({
host_whitelist: ['bginette.fr'],
})
.normalizeEmail({
all_lowercase: true,
}).trim(),
})
)
export const verifyCodeValidator = vine.compile(
vine.object({
code: vine.string().minLength(6).maxLength(6),
})
)
export const registerValidator = vine.compile(
vine.object({
userId: vine.number().positive(),
className: vine.string().minLength(2).maxLength(50),
token: vine.string(),
})
)
export const credentialsValidator = vine.compile(
vine.object({
username: vine.string().minLength(1).maxLength(255),
password: vine.string().minLength(1).maxLength(255),
})
)
// TODO: Magic link login
// export const magicLinkValidator = vine.compile(
// vine.object({
// token: vine.string(),
// })
// )
// export const listenValidator = vine.compile(
// vine.object({
// token: vine.string().uuid(),
// })
// )
// export const exchangeTokenValidator = vine.compile(
// vine.object({
// token: vine.string().uuid(),
// })
// )