feat: add credentials authentication (#1)
This commit is contained in:
1
packages/validation/src/index.ts
Normal file
1
packages/validation/src/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from "./user";
|
||||
20
packages/validation/src/user.ts
Normal file
20
packages/validation/src/user.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import { z } from "zod";
|
||||
|
||||
const usernameSchema = z.string().min(3).max(255);
|
||||
const passwordSchema = z.string().min(8).max(255);
|
||||
|
||||
export const initUserSchema = z
|
||||
.object({
|
||||
username: usernameSchema,
|
||||
password: passwordSchema,
|
||||
repeatPassword: z.string(),
|
||||
})
|
||||
.refine((data) => data.password === data.repeatPassword, {
|
||||
path: ["repeatPassword"],
|
||||
message: "Passwords do not match",
|
||||
});
|
||||
|
||||
export const signInSchema = z.object({
|
||||
name: z.string(),
|
||||
password: z.string(),
|
||||
});
|
||||
Reference in New Issue
Block a user