From 2bd531a343b0a8a0e8adef3073f3b03f35e2d094 Mon Sep 17 00:00:00 2001 From: Nguyen Khanh Binh Date: Wed, 22 Sep 2021 14:52:42 +0700 Subject: [PATCH] Fix the issue when user first time login to the system `uid` will be `null` after calling `db.getObjectField` if uid is not found corresponding to ldapid. In this case, need to return `{uid:0}` to ask the system to create new user --- index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/index.js b/index.js index 345c5bb..375cb43 100644 --- a/index.js +++ b/index.js @@ -378,6 +378,10 @@ if (err) { return callback(err); } + // Fix the issue when ldapid is not existed yet + if (!uid) { + return callback(null, {uid:0}); + } user.getUserData(uid, (err, data) => { if (err) { return callback(err);