import { z } from 'zod'
export const createPasswordSchema = z
.object({
// According to the SOC 2 Logical Access policy, the password must meet the following requirements:
// Length: At least 12 characters.
// Complexity: Must include a mix of uppercase and lowercase letters, numbers, and symbols.
password: z
.string()
// 1. At least 12 characters
.min(12, 'length')
// 2. At least one lowercase letter
.regex(/[a-z]/, 'lowercase')
// 3. At least one uppercase letter
.regex(/[A-Z]/, 'uppercase')
// 4. At least one digit
.regex(/\d/, 'number')
// 5. At least one symbol
.regex(/[^A-Za-z0-9]/, 'special'),
confirmation: z.string(),
})
// 6. Match with confirmation
.refine(({ password, confirmation }) => password === confirmation, {
message: 'noMatch',
})
import { z } from 'zod'
export const createPasswordSchema = z
.object({
// According to the SOC 2 Logical Access policy, the password must meet the following requirements:
// Length: At least 12 characters.
// Complexity: Must include a mix of uppercase and lowercase letters, numbers, and symbols.
password: z
.string()
// 1. At least 12 characters
.min(12, 'length')
// 2. At least one lowercase letter
.regex(/[a-z]/, 'lowercase')
// 3. At least one uppercase letter
.regex(/[A-Z]/, 'uppercase')
// 4. At least one digit
.regex(/\d/, 'number')
// 5. At least one symbol
.regex(/[^A-Za-z0-9]/, 'special'),
confirmation: z.string(),
})
// 6. Match with confirmation
.refine(({ password, confirmation }) => password === confirmation, {
message: 'noMatch',
})