feat: use regex
This commit is contained in:
@@ -39,18 +39,11 @@ const Register = () => {
|
|||||||
const submitForm = async (e: any) => {
|
const submitForm = async (e: any) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
// Basic "@" check (minimal)
|
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
||||||
if (!email.includes("@")) {
|
if (!emailRegex.test(email)) {
|
||||||
notify("error", "Invalid email format");
|
notify("error", "Invalid email format");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Optional: Better regex-based email format check
|
|
||||||
// const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
||||||
// if (!emailRegex.test(email)) {
|
|
||||||
// notify("error", t('register.error.invalid_email') || "Invalid email format");
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
|
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user