mirror of
https://github.com/harivansh-afk/Saas-Teamspace.git
synced 2026-04-21 06:04:48 +00:00
initial commit
This commit is contained in:
commit
ef9ccf22d3
133 changed files with 20802 additions and 0 deletions
54
schemas/index.ts
Normal file
54
schemas/index.ts
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
import * as z from 'zod'
|
||||
|
||||
// Do not allow spaces in password
|
||||
const noSpaces = (value: string) => {
|
||||
if (value.includes(' ')) {
|
||||
return false
|
||||
} else {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
export const LoginSchema = z.object({
|
||||
email: z.string().email(),
|
||||
password: z
|
||||
.string()
|
||||
.min(1, {
|
||||
message: 'Password is required'
|
||||
})
|
||||
.refine(noSpaces, {
|
||||
message: 'Password cannot contain spaces'
|
||||
})
|
||||
})
|
||||
|
||||
export const RegisterSchema = z.object({
|
||||
email: z.string().email(),
|
||||
password: z
|
||||
.string()
|
||||
.min(8, {
|
||||
message: 'Minimum 8 characters'
|
||||
})
|
||||
.refine(noSpaces, {
|
||||
message: 'Password cannot contain spaces'
|
||||
}),
|
||||
name: z.string().min(1, {
|
||||
message: 'Name is required'
|
||||
})
|
||||
})
|
||||
|
||||
export const ResetSchema = z.object({
|
||||
email: z.string().email({
|
||||
message: 'Email is required'
|
||||
})
|
||||
})
|
||||
|
||||
export const NewPasswordSchema = z.object({
|
||||
password: z
|
||||
.string()
|
||||
.min(8, {
|
||||
message: 'Minimum 8 characters'
|
||||
})
|
||||
.refine(noSpaces, {
|
||||
message: 'Password cannot contain spaces'
|
||||
})
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue