From d2cdbdfaac0eab1d850c10c813839a90f347245e Mon Sep 17 00:00:00 2001 From: david Date: Tue, 23 Jul 2019 11:58:56 +0200 Subject: [PATCH] a --- modules/auth/auth.controller.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/auth/auth.controller.js b/modules/auth/auth.controller.js index 33cd90d..9b83cd8 100644 --- a/modules/auth/auth.controller.js +++ b/modules/auth/auth.controller.js @@ -78,7 +78,9 @@ async function register(req, res, next) { } }; - newUser = cleanAdminData(newUser.toJSON()); + if (newUser) + newUser = cleanAdminData(newUser.toJSON()); + newUser.token = tokens.token; console.log('>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>'); console.log(newUser);