From 1686ec01be7cb1a740318e54ac56525c14523926 Mon Sep 17 00:00:00 2001 From: Thomas E Lackey Date: Tue, 15 Aug 2023 05:46:30 +0000 Subject: [PATCH] Catch login errors --- src/middleware/register.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/middleware/register.ts b/src/middleware/register.ts index a5af390..07e5d69 100644 --- a/src/middleware/register.ts +++ b/src/middleware/register.ts @@ -14,15 +14,17 @@ export const RegisterMW : MiddlewareFunction = async (request, response, data, r return; } - const client = await getKeyCloakClient(); const userRequest = { username: data.json.username, + enabled: true, groups: Config.TARGET_GROUPS, realm: Config.TARGET_REALM }; - log.debug('Creating user:', userRequest); try { + const client = await getKeyCloakClient(); + + log.debug('Creating user:', userRequest); const result = await client.users.create(userRequest); log.debug('Created user:', result.id); const user = await client.users.findOne({ realm: userRequest.realm, id: result.id});