From 230fe9ea11e6befd0c5b65c51873a59fdb4ab0bd Mon Sep 17 00:00:00 2001 From: Hoan Luu Huu <110280845+xquanluu@users.noreply.github.com> Date: Mon, 11 Dec 2023 20:36:19 +0700 Subject: [PATCH] feat client direct call from registration webhook (#562) * feat client direct call from registration webhook * feat client direct call from registration webhook * wip --- lib/middleware.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/middleware.js b/lib/middleware.js index 5e9443c2..56978774 100644 --- a/lib/middleware.js +++ b/lib/middleware.js @@ -52,10 +52,16 @@ module.exports = function(srf, logger) { let clientDb = null; if (req.has('X-Authenticated-User')) { req.locals.originatingUser = req.get('X-Authenticated-User'); + let clientSettings; const arr = /^(.*)@(.*)/.exec(req.locals.originatingUser); if (arr) { - [clientDb] = await lookupClientByAccountAndUsername(account_sid, arr[1]); + [clientSettings] = await lookupClientByAccountAndUsername(account_sid, arr[1]); } + clientDb = await registrar.query(req.locals.originatingUser); + clientDb = { + ...clientDb, + ...clientSettings, + }; } // check for call to application