From aa22c9f378566581bb505d6c180e290965b6ad93 Mon Sep 17 00:00:00 2001 From: Nate Kelley <133379588+nate-kelley-buster@users.noreply.github.com> Date: Wed, 9 Jul 2025 11:02:51 -0600 Subject: [PATCH] Update apps/web/src/components/features/security/ApprovedEmailDomains.tsx Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> --- .../features/security/ApprovedEmailDomains.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/apps/web/src/components/features/security/ApprovedEmailDomains.tsx b/apps/web/src/components/features/security/ApprovedEmailDomains.tsx index 2911c95d4..ee46b0ed3 100644 --- a/apps/web/src/components/features/security/ApprovedEmailDomains.tsx +++ b/apps/web/src/components/features/security/ApprovedEmailDomains.tsx @@ -89,8 +89,14 @@ const AddDomainInput = React.memo( const [newDomain, setNewDomain] = useState(''); const handleAddDomain = useMemoizedFn(async () => { - if (!newDomain.trim()) return; - + const domain = newDomain.trim(); + if (!domain) return; + + const domainRegex = /^[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9]\.[a-zA-Z]{2,}$/; + if (!domainRegex.test(domain)) { + openErrorMessage('Please enter a valid domain name'); + return; + } try { await addDomain({ domains: [newDomain.trim()] }); setNewDomain('');