feat: email regex check

This commit is contained in:
amhsirak
2025-07-12 01:38:14 +05:30
parent a56bef3f62
commit 9d7661231a

View File

@@ -33,6 +33,14 @@ router.post("/register", async (req, res) => {
}); });
} }
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
if (!emailRegex.test(email)) {
return res.status(400).json({
error: "VALIDATION_ERROR",
code: "register.validation.invalid_email_format"
});
}
if (!password || password.length < 6) { if (!password || password.length < 6) {
return res.status(400).json({ return res.status(400).json({
error: "VALIDATION_ERROR", error: "VALIDATION_ERROR",