throw an error if invalid email address is provided
Signed-off-by: James Ketrenos <james.p.ketrenos@intel.com>
This commit is contained in:
parent
4790e8e62d
commit
f780fc7c4d
@ -101,7 +101,7 @@ router.post("/create", function(req, res) {
|
|||||||
let re = /^(([^<>()\[\]\\.,;:\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,}))$/;
|
let re = /^(([^<>()\[\]\\.,;:\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 (!re.exec(mail)) {
|
if (!re.exec(mail)) {
|
||||||
console.log("Invalid email address: " + mail);
|
console.log("Invalid email address: " + mail);
|
||||||
return res.status(400).send("Invalid email address.");
|
throw "Invalid email address.";
|
||||||
}
|
}
|
||||||
}).then(function() {
|
}).then(function() {
|
||||||
return new Promise(function(resolve, reject) {
|
return new Promise(function(resolve, reject) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user