when ldap there are no credentials in keycloak (#3483)

This commit is contained in:
Erik Jan de Wit 2022-10-10 21:47:07 +02:00 committed by GitHub
parent 4c245e4a1e
commit 1214330e3a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -91,16 +91,19 @@ export const ResetPasswordDialog = ({
value: password,
},
});
const { id } = (
await adminClient.users.getCredentials({ id: user.id! })
).find((c) => c.type === "password")!;
await adminClient.users.updateCredentialLabel(
{
id: user.id!,
credentialId: id!,
},
t("defaultPasswordLabel")
);
const credentials = await adminClient.users.getCredentials({
id: user.id!,
});
const credentialLabel = credentials.find((c) => c.type === "password");
if (credentialLabel) {
await adminClient.users.updateCredentialLabel(
{
id: user.id!,
credentialId: credentialLabel.id!,
},
t("defaultPasswordLabel")
);
}
addAlert(
isResetPassword
? t("resetCredentialsSuccess")