From e1cbfb230a08a51c40e231a3c363fecbd0d11809 Mon Sep 17 00:00:00 2001 From: Birm Date: Fri, 21 Jun 2024 14:20:23 -0400 Subject: [PATCH] parse first --- handlers/customHandlers.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/handlers/customHandlers.js b/handlers/customHandlers.js index 0a0e210..758e169 100644 --- a/handlers/customHandlers.js +++ b/handlers/customHandlers.js @@ -143,16 +143,18 @@ function editOwnUser(db, collection) { function impersonate() { return function(req, res, next) { - dataHandlers.User.forLogin(req.body.email).then((x)=>{ + let body = JSON.parse(req.body); + let email = body.email; + dataHandlers.User.forLogin(]email).then((x)=>{ console.log("here"); - console.log(req.body.email); + console.log(email); console.log(x); const newToken = {}; newToken.userType = x[0].userType || 'Null'; newToken.userFilter = x[0].userFilter || ['Public']; - newToken.sub = req.body.email; - newToken.email = req.body.email; - newToken.name = req.body.email; + newToken.sub = email; + newToken.email = email; + newToken.name = email; newToken.data = x[0]; req.data = newToken; next()