Add password strength indicator and use crypto safe random PWs

This commit is contained in:
Manuel
2023-08-01 17:42:19 +02:00
parent b4c6896850
commit 2035b20690
6 changed files with 158 additions and 35 deletions

View File

@@ -1,6 +1,16 @@
import { z } from 'zod';
import { CustomErrorParams } from '~/utils/i18n-zod-resolver';
export const passwordSchema = z
.string()
.min(8)
.max(100)
.refine((value) => /[0-9]/.test(value))
.refine((value) => /[a-z]/.test(value))
.refine((value) => /[A-Z]/.test(value))
.refine((value) => /[$&+,:;=?@#|'<>.^*()%!-]/.test(value));
export const signInSchema = z.object({
name: z.string(),
password: z.string(),
@@ -22,7 +32,7 @@ export const signUpFormSchema = z
export const createNewUserSchema = z.object({
username: z.string(),
email: z.string().email().optional(),
password: z.string().min(8).max(100),
password: passwordSchema,
});
export const colorSchemeParser = z