From 920a66a1659f5fbe8f7c614aad47cc7dc47abb5d Mon Sep 17 00:00:00 2001 From: Pahansith Gunathilake Date: Mon, 27 May 2019 06:21:14 +0000 Subject: [PATCH] Fix user creation password auto generation --- .../mgt/jaxrs/service/impl/UserManagementServiceImpl.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/UserManagementServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/UserManagementServiceImpl.java index 329c559903..8bcb3d934b 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/UserManagementServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/UserManagementServiceImpl.java @@ -143,7 +143,13 @@ public class UserManagementServiceImpl implements UserManagementService { "was refused.").build()).build(); } - String initialUserPassword = this.generateInitialUserPassword(); + String initialUserPassword; + if (userInfo.getPassword() != null) { + initialUserPassword = userInfo.getPassword(); + } else { + initialUserPassword = this.generateInitialUserPassword(); + } + Map defaultUserClaims = this.buildDefaultUserClaims(userInfo.getFirstname(), userInfo.getLastname(), userInfo.getEmailAddress());