feat: use password input (#163)
* feat: use password input * chore: address pull request feedback * fix: typo in function name * fix: deepsource issues --------- Co-authored-by: Meier Lukas <meierschlumpf@gmail.com>
This commit is contained in:
@@ -3,17 +3,20 @@ import { z } from "zod";
|
||||
const usernameSchema = z.string().min(3).max(255);
|
||||
const passwordSchema = z.string().min(8).max(255);
|
||||
|
||||
const initUserSchema = z
|
||||
const createUserSchema = z
|
||||
.object({
|
||||
username: usernameSchema,
|
||||
password: passwordSchema,
|
||||
confirmPassword: z.string(),
|
||||
email: z.string().email().optional(),
|
||||
})
|
||||
.refine((data) => data.password === data.confirmPassword, {
|
||||
path: ["confirmPassword"],
|
||||
message: "Passwords do not match",
|
||||
});
|
||||
|
||||
const initUserSchema = createUserSchema;
|
||||
|
||||
const signInSchema = z.object({
|
||||
name: z.string(),
|
||||
password: z.string(),
|
||||
@@ -22,5 +25,6 @@ const signInSchema = z.object({
|
||||
export const userSchemas = {
|
||||
signIn: signInSchema,
|
||||
init: initUserSchema,
|
||||
create: createUserSchema,
|
||||
password: passwordSchema,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user