From 008fb62e377dd7ecc0aa50cfa24071a76ca7c702 Mon Sep 17 00:00:00 2001 From: Ferruh Cihan <63190600+ferruhcihan@users.noreply.github.com> Date: Fri, 27 Sep 2024 16:12:53 +0200 Subject: [PATCH] test: update user --- src/operator/keycloak.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/operator/keycloak.ts b/src/operator/keycloak.ts index cb710b8..d4fbeba 100644 --- a/src/operator/keycloak.ts +++ b/src/operator/keycloak.ts @@ -720,10 +720,13 @@ async function createUpdateUser(api: any, user: any) { try { if (existingUser) { + console.log('existingUser', existingUser) console.debug(`User with email ${email} already exists, updating user`) - const userConfWithoutCredentials = omit(userConf, ['credentials']) + const updatedUserConf = existingUser.requiredActions?.includes('UPDATE_PASSWORD') + ? userConf + : omit(userConf, ['credentials']) await doApiCall(errors, `Updating user ${username}`, async () => - api.users.realmUsersIdPut(keycloakRealm, existingUser.id as string, userConfWithoutCredentials), + api.users.realmUsersIdPut(keycloakRealm, existingUser.id as string, updatedUserConf), ) } else { await doApiCall(errors, `Creating user ${username}`, () => api.users.realmUsersPost(keycloakRealm, userConf))