Skip to content

Commit 8b23c2f

Browse files
committed
add password security
1 parent a428854 commit 8b23c2f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

frontend/src/routes/login/logic.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,13 @@ import { useNavigate } from 'react-router-dom';
99

1010
export const loginFormSchema = z.object({
1111
username: z.string().min(1, getEmptyFieldErrorMessage('Username')),
12-
password: z.string().min(1, getEmptyFieldErrorMessage('Password')),
12+
password: z
13+
.string()
14+
.min(8, 'Password must be at least 8 characters')
15+
.regex(/[A-Z]/, 'Password must contain at least one uppercase letter')
16+
.regex(/[a-z]/, 'Password must contain at least one lowercase letter')
17+
.regex(/[0-9]/, 'Password must contain at least one number')
18+
.regex(/[^A-Za-z0-9]/, 'Password must contain at least one special character'),
1319
});
1420

1521
type ILoginFormSchema = z.infer<typeof loginFormSchema>;

0 commit comments

Comments
 (0)