From 9bcb3adfe2d7762f4e3d78fd5e1239c7b2334c43 Mon Sep 17 00:00:00 2001 From: sudoer777 <78781902+sudoer777@users.noreply.github.com> Date: Thu, 2 Dec 2021 13:16:07 -0700 Subject: [PATCH] Add API support for managing account names --- routes/manage.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/routes/manage.js b/routes/manage.js index a5cdc1b..b1d8809 100644 --- a/routes/manage.js +++ b/routes/manage.js @@ -189,6 +189,7 @@ router.get('/account', checkLoginStatus.user, (req, res, next) => { }); router.post('/account', checkLoginStatus.user, async function(req, res, next) { + const name = req.body.name; const email = req.body.email; const password = req.body.password; @@ -206,8 +207,8 @@ router.post('/account', checkLoginStatus.user, async function(req, res, next) { const isAdmin = loggedInAccountIsAdmin ? !!req.body.admin : false; if(remove) await accounts.remove(accountID); - else if(accountID) await accounts.edit(accountID, email, password, isAdmin); - else await accounts.create(req.body.email, req.body.password, !!req.body.admin); + else if(accountID) await accounts.edit(accountID, email, password, isAdmin, name); + else await accounts.create(email, password, !!req.body.admin, name); res.redirect('/manage#accounts'); }