diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/util/UserUtil.java b/openmetadata-service/src/main/java/org/openmetadata/service/util/UserUtil.java index b0d31579838..5cad3d686fd 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/util/UserUtil.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/util/UserUtil.java @@ -76,8 +76,9 @@ public final class UserUtil { if (authProvider.equals(AuthProvider.BASIC)) { if (originalUser.getAuthenticationMechanism() == null || originalUser.getAuthenticationMechanism().equals(new AuthenticationMechanism())) { - updateUserWithHashedPwd(updatedUser, getPassword()); - EmailUtil.sendInviteMailToAdmin(updatedUser, ADMIN_USER_NAME); + String randomPwd = getPassword(); + updateUserWithHashedPwd(updatedUser, randomPwd); + EmailUtil.sendInviteMailToAdmin(updatedUser, randomPwd); } } else { updatedUser.setAuthenticationMechanism(new AuthenticationMechanism()); @@ -100,8 +101,9 @@ public final class UserUtil { updatedUser = user(username, domain, username).withIsAdmin(isAdmin).withIsEmailVerified(true); // Update Auth Mechanism if not present, and send mail to the user if (authProvider.equals(AuthProvider.BASIC)) { - updateUserWithHashedPwd(updatedUser, getPassword()); - EmailUtil.sendInviteMailToAdmin(updatedUser, ADMIN_USER_NAME); + String randomPwd = getPassword(); + updateUserWithHashedPwd(updatedUser, randomPwd); + EmailUtil.sendInviteMailToAdmin(updatedUser, randomPwd); } }