mirror of
https://github.com/Ravinou/borgwarehouse
synced 2024-06-10 09:52:22 +02:00
fix: backend regex for email improved #38
This commit is contained in:
parent
cc54d0d6ba
commit
48e6df7f55
|
@ -35,7 +35,7 @@ export default async function handler(req, res) {
|
||||||
|
|
||||||
//2 : control the data
|
//2 : control the data
|
||||||
const emailRegex = new RegExp(
|
const emailRegex = new RegExp(
|
||||||
/^([a-z0-9_\.-]+)@([\da-z\.-_]+)\.([a-z\.]{2,6})$/g
|
/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
|
||||||
);
|
);
|
||||||
if (!emailRegex.test(email)) {
|
if (!emailRegex.test(email)) {
|
||||||
res.status(400).json({ message: 'Your email is not valid' });
|
res.status(400).json({ message: 'Your email is not valid' });
|
||||||
|
|
Loading…
Reference in a new issue