Skip to content

Commit

Permalink
parse first
Browse files Browse the repository at this point in the history
  • Loading branch information
birm committed Jun 21, 2024
1 parent 21cc603 commit e1cbfb2
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions handlers/customHandlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit e1cbfb2

Please sign in to comment.