Skip to content

Commit 95aae3c

Browse files
committed
Add handling for LOWCODER_CREATE_SIGNUP_WORKSPACE
1 parent 6845453 commit 95aae3c

File tree

5 files changed

+14
-4
lines changed

5 files changed

+14
-4
lines changed

server/api-service/lowcoder-sdk/src/main/java/org/lowcoder/sdk/config/AuthProperties.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ public class AuthProperties {
2828
private Oauth2Simple google = new Oauth2Simple();
2929
private Oauth2Simple github = new Oauth2Simple();
3030
private ApiKey apiKey = new ApiKey();
31+
private Boolean workspaceCreation;
3132

3233
@Getter
3334
@Setter

server/api-service/lowcoder-server/src/main/java/org/lowcoder/api/authentication/service/AuthenticationApiServiceImpl.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import org.lowcoder.domain.user.model.*;
3030
import org.lowcoder.domain.user.service.UserService;
3131
import org.lowcoder.sdk.auth.AbstractAuthConfig;
32+
import org.lowcoder.sdk.config.AuthProperties;
3233
import org.lowcoder.sdk.exception.BizError;
3334
import org.lowcoder.sdk.exception.BizException;
3435
import org.lowcoder.sdk.util.CookieHelper;
@@ -85,6 +86,9 @@ public class AuthenticationApiServiceImpl implements AuthenticationApiService {
8586
@Autowired
8687
private JWTUtils jwtUtils;
8788

89+
@Autowired
90+
private AuthProperties authProperties;
91+
8892
@Override
8993
public Mono<AuthUser> authenticateByForm(String loginId, String password, String source, boolean register, String authId, String orgId) {
9094
return authenticate(authId, source, new FormAuthRequestContext(loginId, password, register, orgId));
@@ -142,7 +146,9 @@ public Mono<Void> loginOrRegister(AuthUser authUser, ServerWebExchange exchange,
142146
})
143147
// after register
144148
.delayUntil(user -> {
145-
if (user.getIsNewUser()) {
149+
boolean createWorkspace =
150+
authUser.getOrgId() == null && StringUtils.isBlank(invitationId) && authProperties.getWorkspaceCreation();
151+
if (user.getIsNewUser() && createWorkspace) {
146152
return onUserRegister(user);
147153
}
148154
return Mono.empty();

server/api-service/lowcoder-server/src/main/resources/application-lowcoder.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ spring:
33
mongodb:
44
authentication-database: admin
55
auto-index-creation: false
6-
uri: mongodb://lowcoder:secret123@localhost:27017/lowcoder?authSource=admin
6+
uri: mongodb://192.168.8.103:27017/lowcoder?authSource=admin
77
redis:
8-
url: redis://localhost:6379
8+
url: redis://192.168.8.103:6379
99
main:
1010
allow-bean-definition-overriding: true
1111
allow-circular-references: true
@@ -61,4 +61,5 @@ auth:
6161
secret: 5a41b090758b39b226603177ef48d73ae9839dd458ccb7e66f7e7cc028d5a50b
6262
email:
6363
enable: true
64-
enable-register: true
64+
enable-register: true
65+
workspace-creation: false

server/api-service/lowcoder-server/src/main/resources/selfhost/ce/application-selfhost.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ auth:
1313
email:
1414
enable: ${LOGIN_CHANNEL_EMAIL:true}
1515
enable-register: ${ENABLE_USER_SIGN_UP:true}
16+
workspace-creation: ${LOWCODER_CREATE_SIGNUP_WORKSPACE:true}
1617

1718
spring:
1819
data:

server/api-service/lowcoder-server/src/main/resources/selfhost/ce/application.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ auth:
44
email:
55
enable: true
66
enable-register: ${ENABLE_USER_SIGN_UP:true}
7+
workspace-creation: ${LOWCODER_CREATE_SIGNUP_WORKSPACE:true}
78

89
spring:
910
data:

0 commit comments

Comments
 (0)