diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/configurations/ClientUserRepository.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/configurations/ClientUserRepository.java index b99cf69198..5b8c4277f6 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/configurations/ClientUserRepository.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/configurations/ClientUserRepository.java @@ -107,25 +107,6 @@ public class ClientUserRepository implements ServerOAuth2AuthorizedClientReposit .then(Mono.empty()); } - public Mono checkAndCreateUser(OidcUser user) { - User newUser = new User(); - newUser.setName(user.getFullName()); - newUser.setEmail(user.getEmail()); - newUser.setSource(LoginSource.GOOGLE); - newUser.setState(UserState.ACTIVATED); - newUser.setIsEnabled(true); - // TODO: Check if this is a valid permission available in the DB - // TODO: Check to see if this user was invited or is it a new sign up - Set permissions = new HashSet<>(); - // Adding the create organization permission because this is a new user and we will have to create an organization - // after this for the user. - permissions.addAll(AclConstants.PERMISSIONS_CRUD_ORG); - newUser.setPermissions(permissions); - - return userService.findByEmail(user.getEmail()) - .switchIfEmpty(Mono.defer(() -> userService.create(newUser))); //In case the user doesn't exist, create and save the user. - } - @Override public Mono removeAuthorizedClient(String clientRegistrationId, Authentication principal, ServerWebExchange exchange) { diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/UserServiceImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/UserServiceImpl.java index bc857a7c8f..44763b9aaa 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/UserServiceImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/UserServiceImpl.java @@ -423,13 +423,16 @@ public class UserServiceImpl extends BaseService i } Organization personalOrg = new Organization(); - String name; + String firstName; if (user.getName() != null) { - name = user.getName(); + // Get the first word from the full name and assume that that's the user's first name + firstName = user.getName().split(" ")[0]; } else { - name = user.getEmail(); + user.setName(user.getEmail()); + firstName = user.getEmail().split("@")[0]; } - String personalWorkspaceName = name + "'s Personal Workspace"; + + String personalWorkspaceName = firstName + "'s Personal Workspace"; personalOrg.setName(personalWorkspaceName); Mono savedOrganizationMono = organizationService.create(personalOrg);