(value: string)
| 15 | ]) |
| 16 | |
| 17 | export function validateEmail(value: string): string | undefined { |
| 18 | if (!value) return 'Email is required' |
| 19 | const re = /^[^\s@]+@[^\s@]+\.[^\s@]+$/ |
| 20 | if (!re.test(value)) return 'Please enter a valid email address' |
| 21 | const domain = value.slice(value.lastIndexOf('@') + 1).toLowerCase() |
| 22 | const tld = domain.includes('.') ? domain.slice(domain.lastIndexOf('.') + 1) : domain |
| 23 | if (RESERVED_TLDS.has(tld)) { |
| 24 | return `Reserved TLD ".${tld}" is not accepted. Use a real domain (e.g. admin@yourdomain.com).` |
| 25 | } |
| 26 | if (RESERVED_DOMAINS.has(domain)) { |
| 27 | return `Reserved domain "${domain}" is not accepted — the seeder would create no admin. Use a real domain.` |
| 28 | } |
| 29 | return undefined |
| 30 | } |
| 31 | |
| 32 | export function validatePassword(value: string): string | undefined { |
| 33 | if (!value) return 'Password is required' |
no outgoing calls
no test coverage detected