13 |
14 |
15 | minimum 12 characters
16 |
17 |
18 |
19 |
20 | at least 1 uppercase
21 |
22 |
23 |
24 |
25 | at least 1 lowercase
26 |
27 |
28 |
29 |
30 | at least 1 number
31 |
32 |
33 |
34 |
35 | at least 1 special character
36 |
37 |
38 |
39 | );
40 | };
41 |
42 | export const CheckOrX = ({
43 | handler,
44 | password,
45 | children,
46 | }: {
47 | handler: (password: string) => boolean;
48 | password: string | { password: string | null };
49 | children: React.ReactNode;
50 | }) => {
51 | let actualPassword = '';
52 | if (typeof password === 'string') {
53 | actualPassword = password;
54 | } else {
55 | actualPassword = password.password ?? '';
56 | }
57 | const isEmpty = actualPassword.length === 0;
58 | const isValid = useMemo(
59 | () => handler(actualPassword),
60 | [handler, actualPassword],
61 | );
62 |
63 | if (isEmpty) {
64 | return