implemented email format check

This commit is contained in:
Patrick 2025-09-18 16:52:33 +02:00
parent 47c29ad10e
commit 8c03efbfc0
1 changed files with 13 additions and 0 deletions

13
src/lib/util.ts Normal file
View File

@ -0,0 +1,13 @@
function check_email_format(email: string) {
const trimmed = email.trim()
if (trimmed.length > 254) return false
const emailRegex = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:.[a-zA-Z0-9-]+)*$/;
return emailRegex.test(trimmed)
}
export default {
check_email_format,
}