Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/actions/auth.action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export const authRegisterAction = async ({
email,
password,
path,
domain,
}: IRegister) => {
try {
const emailAlreadyExists = await prismadb.user.findFirst({
Expand All @@ -30,6 +31,7 @@ export const authRegisterAction = async ({
name,
email,
password: await hash(password, 10),
domain
},
});

Expand Down
3 changes: 2 additions & 1 deletion src/components/auth/register/form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ const Form = () => {
name: formData.get('name') as string,
email: formData.get('email') as string,
password: formData.get('password') as string,
path: window.location.pathname
path: window.location.pathname,
domain: window.location.hostname.replace('www.','')
};

const validations = registerSchema.safeParse(data);
Expand Down
1 change: 1 addition & 0 deletions src/interfaces/auth.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ export interface IRegister {
email: string;
password: string;
path: string;
domain: string;
}
2 changes: 2 additions & 0 deletions src/validations/auth.validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ export const registerSchema = z.object({
.string({ required_error: 'Password is required' })
.min(8, { message: 'Password must be at least 8 characters' })
.max(100, { message: 'Password must be less than 100 characters' }),
domain: z
.string({ required_error: 'Domain is required' }),
});

export const loginSchema = z.object({
Expand Down