Skip to content

Commit 60708b3

Browse files
committed
feat: add dedicated sign-up config for oauth
Signed-off-by: Hudint Finn Weigand <[email protected]>
1 parent a0b73cd commit 60708b3

File tree

5 files changed

+18
-3
lines changed

5 files changed

+18
-3
lines changed

.docker/selfhost/schema.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,11 @@
148148
"description": "Whether allow new registrations.\n@default true",
149149
"default": true
150150
},
151+
"allowSignupForOauth": {
152+
"type": "boolean",
153+
"description": "Whether allow new registrations via configured oauth.\n@default true",
154+
"default": true
155+
},
151156
"requireEmailDomainVerification": {
152157
"type": "boolean",
153158
"description": "Whether require email domain record verification before accessing restricted resources.\n@default false",
@@ -1123,4 +1128,4 @@
11231128
}
11241129
}
11251130
}
1126-
}
1131+
}

packages/backend/server/src/core/auth/config.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export interface AuthConfig {
88
ttr: number;
99
};
1010
allowSignup: boolean;
11+
allowSignupForOauth: boolean;
1112
requireEmailDomainVerification: boolean;
1213
requireEmailVerification: boolean;
1314
passwordRequirements: ConfigItem<{
@@ -27,6 +28,10 @@ defineModuleConfig('auth', {
2728
desc: 'Whether allow new registrations.',
2829
default: true,
2930
},
31+
allowSignupForOauth: {
32+
desc: 'Whether allow new registrations via configured oauth.',
33+
default: true,
34+
},
3035
requireEmailDomainVerification: {
3136
desc: 'Whether require email domain record verification before accessing restricted resources.',
3237
default: false,

packages/backend/server/src/plugins/oauth/controller.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ export class OAuthController {
224224
return connectedAccount.user;
225225
}
226226

227-
if (!this.config.auth.allowSignup) {
227+
if (!this.config.auth.allowSignupForOauth) {
228228
throw new SignUpForbidden();
229229
}
230230

packages/frontend/admin/src/config.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@
6363
"type": "Boolean",
6464
"desc": "Whether allow new registrations."
6565
},
66+
"allowSignupForOauth": {
67+
"type": "Boolean",
68+
"desc": "Whether allow new registrations via configured oauth."
69+
},
6670
"requireEmailDomainVerification": {
6771
"type": "Boolean",
6872
"desc": "Whether require email domain record verification before accessing restricted resources."
@@ -407,4 +411,4 @@
407411
"desc": "Allowed origin"
408412
}
409413
}
410-
}
414+
}

packages/frontend/admin/src/modules/settings/config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ export const KNOWN_CONFIG_GROUPS = [
5555
module: 'auth',
5656
fields: [
5757
'allowSignup',
58+
'allowSignupForOauth',
5859
// nested json object
5960
{
6061
key: 'passwordRequirements',

0 commit comments

Comments
 (0)