diff --git a/api/helpers/passport.js b/api/helpers/passport.js index 61a83f8..6a1b3b8 100644 --- a/api/helpers/passport.js +++ b/api/helpers/passport.js @@ -111,7 +111,7 @@ function PassportHelper () { if (!req.user) { if (!passport) { // new user signing up, create a new user - user = await User.create(userAttrs) + user = await User.create(userAttrs).fetch() await Passport.create({ ...q, user: user.id diff --git a/config/protocols.js b/config/protocols.js index f16cfbf..5c3fe01 100644 --- a/config/protocols.js +++ b/config/protocols.js @@ -43,9 +43,10 @@ module.exports.protocols = { try { const token = generateToken() const password = user.password + if (!password.length) throw new Error('password cannot be blank') delete user.password - const newUser = User.create(user) + const newUser = await User.create(user).fetch() try { await Passport.create({ protocol: 'local',