From 7715f713ea9652a51c72b548a6a8f48eb20b846d Mon Sep 17 00:00:00 2001 From: Aditya Date: Tue, 19 Nov 2024 16:53:47 +0530 Subject: [PATCH] #2 validation folder alo added in the fix along with full appwrite-auth with cookie fix --- validations/user/recoveryPassword.ts | 10 ++++++++++ validations/user/recoveryPasswordConfirm.ts | 19 +++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 validations/user/recoveryPassword.ts create mode 100644 validations/user/recoveryPasswordConfirm.ts diff --git a/validations/user/recoveryPassword.ts b/validations/user/recoveryPassword.ts new file mode 100644 index 0000000..29bcaa3 --- /dev/null +++ b/validations/user/recoveryPassword.ts @@ -0,0 +1,10 @@ +import { z } from "zod"; + +export const recoveryPasswordSchema = z.object({ + email: z + .string({ + required_error: "Email is required", + invalid_type_error: "Email must be a string", + }) + .email({message: "Invalid email"}), +}) \ No newline at end of file diff --git a/validations/user/recoveryPasswordConfirm.ts b/validations/user/recoveryPasswordConfirm.ts new file mode 100644 index 0000000..5adfca7 --- /dev/null +++ b/validations/user/recoveryPasswordConfirm.ts @@ -0,0 +1,19 @@ +import { z } from "zod"; + +export const recoveryPasswordConfirmSchema = z.object({ + newPassword: z + .string({ + required_error: "New password is required", + invalid_type_error: "New password must be a string", + }) + .min(6, {message: "New password must be at least 6 characters long"}), + confirmPassword: z + .string({ + required_error: "Confirm password is required", + invalid_type_error: "Confirm password must be a string", + }) + .min(6, {message: "Confirm password must be at least 6 characters long"}), +}).refine(data => data.newPassword === data.confirmPassword, { + message: "New password and confirm password must match", + path: ["confirmPassword"], +}); \ No newline at end of file