feat: add credentials authentication (#1)

This commit is contained in:
Meier Lukas
2023-12-10 17:12:20 +01:00
committed by GitHub
parent 41e54d940b
commit 3cedb7fba5
53 changed files with 890 additions and 2105 deletions

View File

@@ -0,0 +1 @@
export * from "./user";

View 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(),
});