From 659fef863dbb81f9e2cb35aad7bac5cc1d8ad6cf Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Mon, 15 Aug 2022 12:19:47 +0200 Subject: Return after handling errors when changing mail address. --- server.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server.js b/server.js index 48310d8..9027a05 100644 --- a/server.js +++ b/server.js @@ -563,9 +563,9 @@ app.get('/change-mail', must_be_logged_in, function (req, res) { app.post('/change-mail', must_be_logged_in, function (req, res) { let newmail = req.body.newmail if (!is_email(newmail)) - res.render('change_mail.pug', { user: req.user, flash: "Invalid mail address!" }) + return res.render('change_mail.pug', { user: req.user, flash: "Invalid mail address!" }) if (SQL_EXISTS_USER_MAIL.get(newmail)) - res.render('change_mail.pug', { user: req.user, flash: "That mail address is already taken!" }) + return res.render('change_mail.pug', { user: req.user, flash: "That mail address is already taken!" }) SQL_UPDATE_USER_MAIL.run(newmail, req.user.user_id) return res.redirect('/profile') }) -- cgit v1.2.3