diff options
author | Chocobozzz <me@florianbigard.com> | 2023-01-19 09:27:16 +0100 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2023-01-19 13:53:40 +0100 |
commit | e364e31e25bd1d4b8d801c845a96d6be708f0a18 (patch) | |
tree | 220785a42af361706eb8243960c5da9cddf4d2be /server/lib/server-config-manager.ts | |
parent | bc48e33b80f357767b98c1d310b04bdda24c6d46 (diff) | |
download | PeerTube-e364e31e25bd1d4b8d801c845a96d6be708f0a18.tar.gz PeerTube-e364e31e25bd1d4b8d801c845a96d6be708f0a18.tar.zst PeerTube-e364e31e25bd1d4b8d801c845a96d6be708f0a18.zip |
Implement signup approval in server
Diffstat (limited to 'server/lib/server-config-manager.ts')
-rw-r--r-- | server/lib/server-config-manager.ts | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/server/lib/server-config-manager.ts b/server/lib/server-config-manager.ts index 78a9546ae..e87e2854f 100644 --- a/server/lib/server-config-manager.ts +++ b/server/lib/server-config-manager.ts | |||
@@ -261,10 +261,17 @@ class ServerConfigManager { | |||
261 | async getServerConfig (ip?: string): Promise<ServerConfig> { | 261 | async getServerConfig (ip?: string): Promise<ServerConfig> { |
262 | const { allowed } = await Hooks.wrapPromiseFun( | 262 | const { allowed } = await Hooks.wrapPromiseFun( |
263 | isSignupAllowed, | 263 | isSignupAllowed, |
264 | |||
264 | { | 265 | { |
265 | ip | 266 | ip, |
267 | signupMode: CONFIG.SIGNUP.REQUIRES_APPROVAL | ||
268 | ? 'request-registration' | ||
269 | : 'direct-registration' | ||
266 | }, | 270 | }, |
267 | 'filter:api.user.signup.allowed.result' | 271 | |
272 | CONFIG.SIGNUP.REQUIRES_APPROVAL | ||
273 | ? 'filter:api.user.request-signup.allowed.result' | ||
274 | : 'filter:api.user.signup.allowed.result' | ||
268 | ) | 275 | ) |
269 | 276 | ||
270 | const allowedForCurrentIP = isSignupAllowedForCurrentIP(ip) | 277 | const allowedForCurrentIP = isSignupAllowedForCurrentIP(ip) |
@@ -273,6 +280,7 @@ class ServerConfigManager { | |||
273 | allowed, | 280 | allowed, |
274 | allowedForCurrentIP, | 281 | allowedForCurrentIP, |
275 | minimumAge: CONFIG.SIGNUP.MINIMUM_AGE, | 282 | minimumAge: CONFIG.SIGNUP.MINIMUM_AGE, |
283 | requiresApproval: CONFIG.SIGNUP.REQUIRES_APPROVAL, | ||
276 | requiresEmailVerification: CONFIG.SIGNUP.REQUIRES_EMAIL_VERIFICATION | 284 | requiresEmailVerification: CONFIG.SIGNUP.REQUIRES_EMAIL_VERIFICATION |
277 | } | 285 | } |
278 | 286 | ||