mirror of
https://github.com/ajnart/homarr.git
synced 2026-02-03 13:19:17 +01:00
✨ Add password strength indicator and use crypto safe random PWs
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user