47 lines
970 B
TypeScript
47 lines
970 B
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(),
|
|
})
|
|
)
|
|
|
|
// 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(),
|
|
// })
|
|
// )
|