remove UPDATE_PASSWORD required action when reset password
Keycloak automatically adds UPDATE_PASSWORD required action when
resetting the user's password with a temporary one. However, it doesn't
automatically remove the UPDATE_PASSWORD required action when resetting
the user's password with a non-temporary password, so this must be done
also in our code.
@@ -335,6 +335,10 @@ public class TenantManagementKeycloakImpl implements TenantManagementInterface {
credential.setValue(newPassword);
credential.setTemporary(false);
retrievedUser.resetPassword(credential);
+ // Remove the UPDATE_PASSWORD required action
+ UserRepresentation userRepresentation = retrievedUser.toRepresentation();
+ userRepresentation.getRequiredActions().remove("UPDATE_PASSWORD");
+ retrievedUser.update(userRepresentation);
return true;
}else{
logger.error("requested User not found");
