MCPcopy
hub / github.com/learnhouse/learnhouse / validateEmail

Function validateEmail

apps/cli/src/utils/validators.ts:17–30  ·  view source on GitHub ↗
(value: string)

Source from the content-addressed store, hash-verified

15])
16
17export 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
32export function validatePassword(value: string): string | undefined {
33 if (!value) return 'Password is required'

Callers 3

setupEnterpriseCiFunction · 0.85
setupCommandFunction · 0.85
unit.test.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected