From e42e52a735b98b5e7e6c841f56e82c12b8defd84 Mon Sep 17 00:00:00 2001 From: mohitdeuex Date: Sat, 15 Jun 2024 00:16:05 +0530 Subject: [PATCH] - Fix User Signup - p2 --- .../service/resources/teams/UserResource.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/teams/UserResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/teams/UserResource.java index 4c8cbfbafa5f..c49be3c22ab5 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/teams/UserResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/teams/UserResource.java @@ -578,12 +578,15 @@ public Response createUser( } } - // Send Invite mail to user - sendInviteMailToUserForBasicAuth(uriInfo, user, create); + if (createdUserRes != null) { + // Send Invite mail to user + sendInviteMailToUserForBasicAuth(uriInfo, user, create); - // Update response to remove auth fields - decryptOrNullify(securityContext, (User) createdUserRes.getEntity()); - return createdUserRes; + // Update response to remove auth fields + decryptOrNullify(securityContext, (User) createdUserRes.getEntity()); + return createdUserRes; + } + return Response.status(BAD_REQUEST).entity("User Cannot be created Successfully.").build(); } private void validateAndAddUserAuthForBasic(User user, CreateUser create) {