Files
go_nuxt_admin/utils/validations.ts
Beyhan Oğur 5285a0dd86 first commit
2026-04-26 22:07:47 +03:00

28 lines
1.1 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { z } from 'zod';
export const loginSchema = z.object({
email: z
.string()
.min(1, { message: 'E-posta adresi zorunludur' })
.email({ message: 'Geçerli bir e-posta adresi giriniz' }),
password: z
.string()
.min(1, { message: 'Şifre zorunludur' })
});
export const registerSchema = z.object({
username: z.string().min(3, { message: 'Kullanıcı adı en az 3 karakter olmalıdır' }),
first_name: z.string().min(2, { message: 'Ad en az 2 karakter olmalıdır' }),
last_name: z.string().min(2, { message: 'Soyad en az 2 karakter olmalıdır' }),
email: z.string().email({ message: 'Geçerli bir e-posta adresi giriniz' }),
password: z.string().min(8, { message: 'Şifre en az 8 karakter olmalıdır' }),
passwordConfirm: z.string().min(1, { message: 'Şifre tekrarı zorunludur' })
}).refine((data) => data.password === data.passwordConfirm, {
message: "Şifreler eşleşmiyor",
path: ["passwordConfirm"],
});
export type LoginInput = z.infer<typeof loginSchema>;
export type RegisterInput = z.infer<typeof registerSchema>;