Skip to content

Commit

Permalink
Fixed bug w/ undefined id in user creation
Browse files Browse the repository at this point in the history
  • Loading branch information
aultac committed Mar 23, 2021
1 parent c468820 commit a2a5c40
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions oada/services/users/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down

0 comments on commit a2a5c40

Please sign in to comment.