From 7132273e9ec1cea34f94026fb7dbde272b34a125 Mon Sep 17 00:00:00 2001 From: sudoer777 <78781902+sudoer777@users.noreply.github.com> Date: Fri, 26 Nov 2021 17:08:13 -0700 Subject: [PATCH] Improve redirect for failure editing accounts --- routes/manage.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/routes/manage.js b/routes/manage.js index 5b979fa..8432ff8 100644 --- a/routes/manage.js +++ b/routes/manage.js @@ -214,7 +214,9 @@ router.post('/account', checkLoginStatus.user, async function(req, res, next) { catch (err) { console.error("ERROR: " + err.message); req.flash("error", "An error has occurred."); - res.redirect('/manage/account'); + let URL = '/manage/account'; + if(loggedInAccountIsAdmin && accountID) URL += `?account=${accountID}`; + res.redirect(URL); } } });