From a2a5c400e3616c3974de714950011c4c0e128956 Mon Sep 17 00:00:00 2001 From: Aaron Ault Date: Tue, 23 Mar 2021 17:21:57 +0000 Subject: [PATCH] Fixed bug w/ undefined id in user creation --- oada/services/users/server.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/oada/services/users/server.js b/oada/services/users/server.js index 66d6822b..48743dd6 100644 --- a/oada/services/users/server.js +++ b/oada/services/users/server.js @@ -48,8 +48,10 @@ module.exports = function stopResp() { function createNewUser(req) { const u = cloneDeep(req.user); - u._id = 'users/' + req.userid; - u._key = req.userid; + if (req.userid) { + u._id = req.userid.match(/^users/) ? req.userid : 'users/' + req.userid; + u._key = req.userid.match(/^users/) ? req.userid.replace(/^users\//,'') : req.userid; + } return users .create(u) .then((user) => {