From f64c8899fe56682263db6958364ca538555bb421 Mon Sep 17 00:00:00 2001 From: Arthur Lu Date: Sun, 31 May 2026 02:37:23 +0000 Subject: [PATCH] fix bug in disk routes using getUserObjFromUsername --- src/routes/cluster/disk.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/routes/cluster/disk.js b/src/routes/cluster/disk.js index c30ea4f..9e98b7e 100644 --- a/src/routes/cluster/disk.js +++ b/src/routes/cluster/disk.js @@ -140,9 +140,9 @@ router.post("/:disk/resize", async (req, res) => { }; // attempt to parse user from username - const userObj = global.utils.getUserObjFromUsername(params.username); + const userObj = global.utils.getUserObjFromUsername(req.cookies.username); if (userObj == null) { - res.status(400).send({ auth:true, error:`username ${params.username} does not match format uid@realm.` }); + res.status(400).send({ auth:true, error:`username ${req.cookies.username} does not match format uid@realm.` }); } // check auth for specific instance @@ -211,9 +211,9 @@ router.post("/:disk/move", async (req, res) => { }; // attempt to parse user from username - const userObj = global.utils.getUserObjFromUsername(params.username); + const userObj = global.utils.getUserObjFromUsername(req.cookies.username); if (userObj == null) { - res.status(400).send({ auth:true, error:`username ${params.username} does not match format uid@realm.` }); + res.status(400).send({ auth:true, error:`username ${req.cookies.username} does not match format uid@realm.` }); } // check auth for specific instance @@ -336,11 +336,14 @@ router.post("/:disk/create", async (req, res) => { size: req.body.size, iso: req.body.iso }; + + console.log(req.cookies) // attempt to parse user from username - const userObj = global.utils.getUserObjFromUsername(params.username); + const userObj = global.utils.getUserObjFromUsername(req.cookies.username); if (userObj == null) { - res.status(400).send({ auth:true, error:`username ${params.username} does not match format uid@realm.` }); + res.status(400).send({ auth:true, error:`username ${req.cookies.username} does not match format uid@realm.` }); + return; } // check auth for specific instance