fix error on email validation failure

This commit is contained in:
Bilal Catic
2019-09-30 19:33:01 +02:00
parent 3e5371f780
commit 502c7c3e35

View File

@@ -22,12 +22,14 @@ const postQuerySubmit = async (req, res) => {
const emailInput = req.body.email; const emailInput = req.body.email;
const emailConfirmInput = req.body.confirm; const emailConfirmInput = req.body.confirm;
const title = "Upišite vaš e-mail";
let error = "Greška ! Unesite validan email"; let error = "Greška ! Unesite validan email";
if (emailInput !== emailConfirmInput) { if (emailInput !== emailConfirmInput) {
error = "Greška ! Unešeni emailovi nisu isti"; error = "Greška ! Unešeni emailovi nisu isti";
res.render("querySubmit", { res.render("querySubmit", {
error error,
title
}); });
return; return;
} }
@@ -35,7 +37,8 @@ const postQuerySubmit = async (req, res) => {
if (!isValidEmail(emailInput)) { if (!isValidEmail(emailInput)) {
error = "Greška ! Unesite validan email"; error = "Greška ! Unesite validan email";
res.render("querySubmit", { res.render("querySubmit", {
error error,
title
}); });
return; return;
} }