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:
Manuel
2024-03-02 17:46:03 +01:00
committed by GitHub
parent 990be660c5
commit 2a83df3485
5 changed files with 69 additions and 40 deletions

View File

@@ -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,
};