diff --git a/auth.config.ts b/auth.config.ts index 55a81edcca..105a6934c7 100644 --- a/auth.config.ts +++ b/auth.config.ts @@ -32,17 +32,17 @@ export const authConfig = { newUser: "/sign-up", }, callbacks: { - authorized({ auth, request: { nextUrl } }) { - const isLoggedIn = !!auth?.user; - const isOnDashboard = nextUrl.pathname.startsWith("/"); - if (isOnDashboard) { - if (isLoggedIn) return true; - return false; // Redirect unauthenticated users to login page - } else if (isLoggedIn) { - return Response.redirect(new URL("/", nextUrl)); - } - return true; - }, + // authorized({ auth, request: { nextUrl } }) { + // const isLoggedIn = !!auth?.user; + // const isOnDashboard = nextUrl.pathname.startsWith("/"); + // if (isOnDashboard) { + // if (isLoggedIn) return true; + // return false; // Redirect unauthenticated users to login page + // } else if (isLoggedIn) { + // return Response.redirect(new URL("/", nextUrl)); + // } + // return true; + // }, jwt({ token, user }) { if (user) { diff --git a/types/authFormSchema.ts b/types/authFormSchema.ts index 3cd577de69..89c8904f56 100644 --- a/types/authFormSchema.ts +++ b/types/authFormSchema.ts @@ -3,7 +3,8 @@ import { z } from "zod"; export const authFormSchema = (type: string) => z.object({ // Sign Up - companyName: type === "sign-in" ? z.string().optional() : z.string().min(3), + companyName: + type === "sign-in" ? z.string().optional() : z.string().min(3).optional(), firstName: type === "sign-in" ? z.string().optional() @@ -13,6 +14,8 @@ export const authFormSchema = (type: string) => message: "The name must be at least 3 characters.", }) .max(20), + confirmPassword: + type === "sign-in" ? z.string().optional() : z.string().min(6), termsAndConditions: type === "sign-in" ? z.enum(["true"]).optional()