feat: email regex check
This commit is contained in:
@@ -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",
|
||||||
|
|||||||
Reference in New Issue
Block a user