diff options
| author | it-fixcomart <it@fixcomart.co.id> | 2025-01-15 16:29:48 +0700 |
|---|---|---|
| committer | it-fixcomart <it@fixcomart.co.id> | 2025-01-15 16:29:48 +0700 |
| commit | 98236a47c3558c4b701009a275c7ae917ee8bf67 (patch) | |
| tree | 21e0300680a724c8a24ed815ea4e9a32ab13a895 /src-migrate/validations/auth.ts | |
| parent | 1fa1a7873aa67cdd9ca211c239276a148cd4cdda (diff) | |
| parent | 7a14ed5ccdde86d0400d6aa02ac866317d4add63 (diff) | |
Merge branch 'new-release' into Feature/switch-account
# Conflicts:
# src/lib/auth/components/CompanyProfile.jsx
# src/lib/auth/components/Menu.jsx
Diffstat (limited to 'src-migrate/validations/auth.ts')
| -rw-r--r-- | src-migrate/validations/auth.ts | 75 |
1 files changed, 72 insertions, 3 deletions
diff --git a/src-migrate/validations/auth.ts b/src-migrate/validations/auth.ts index 0df80a2a..6cdd930b 100644 --- a/src-migrate/validations/auth.ts +++ b/src-migrate/validations/auth.ts @@ -1,8 +1,77 @@ import { z } from 'zod'; - +const forbiddenWords = [ + 'anjing', + 'babi', + 'monyet', + 'bangsat', + ' tai ', + 'kontol', + 'memek', + ' bol ', + 'pantat', + 'jembut', + 'mencret', + 'ngehe', + 'ngewe', + 'ngentot', + 'ngews', + 'jembudh', + 'jembud', + 'b4b1', + 'b4bi', + 'bab1', + 'mati', + 'perkosa', + 'bunuh', + 'membunuh', + 't41', + 't4i', + 'ta1', + 'anjay', + 'anjir', + 'anying', + 'tokay', + 'peler', + 'meki', + 'tetek', + 'teteq', + 'tobrut', + 'toket', + 'pentil', + 'pantek', + 'bangke', + 'kampret', + 'sialan', + 'beol', + 'bego', + 'goblok', + 'tolol', + 'jancok', + 'jablay', + 'jalang', + 'lonte', + 'jancuk', + 'pelacur', + 'pelakor', +]; export const registerSchema = z .object({ - name: z.string().min(1, { message: 'Nama harus diisi' }), + name: z + .string() + .min(1, { message: 'Nama harus diisi' }) + .refine( + (value) => { + const lowerValue = value.toLowerCase(); + const hasForbiddenWord = forbiddenWords.some((word) => + lowerValue.includes(word) + ); + const isStandaloneTai = /\b(tai)\b/.test(lowerValue); + const isStandaloneBol = /\b(bol)\b/.test(lowerValue); + + return !hasForbiddenWord && !isStandaloneTai && !isStandaloneBol; + }, + { message: 'Nama mengandung kata yang tidak diperbolehkan' } + ), email: z .string() .min(1, { message: 'Email harus diisi' }) @@ -11,7 +80,7 @@ export const registerSchema = z phone: z .string() .min(1, { message: 'Nomor telepon harus diisi' }) - .refine((val) => /^\d{10,12}$/.test(val), { + .refine((val) => /^\d{9,13}$/.test(val), { message: 'Format nomor telepon tidak valid, contoh: 081234567890', }), type_acc: z.string().optional(), |
