aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-10-25 13:54:32 +0200
committerChocobozzz <me@florianbigard.com>2019-10-25 13:54:32 +0200
commit4ce7eb71ba28a563336c07d10c182ff89461c72b (patch)
tree9350704adae97d145548d0b2cfdde3bd95b56dd5 /server/helpers
parent45863288582a788def282ec25d437b1795510315 (diff)
downloadPeerTube-4ce7eb71ba28a563336c07d10c182ff89461c72b.tar.gz
PeerTube-4ce7eb71ba28a563336c07d10c182ff89461c72b.tar.zst
PeerTube-4ce7eb71ba28a563336c07d10c182ff89461c72b.zip
Add plugin hook on registration
Diffstat (limited to 'server/helpers')
-rw-r--r--server/helpers/signup.ts8
1 files changed, 4 insertions, 4 deletions
diff --git a/server/helpers/signup.ts b/server/helpers/signup.ts
index 5eb56b3cf..7c73f7c5c 100644
--- a/server/helpers/signup.ts
+++ b/server/helpers/signup.ts
@@ -4,19 +4,19 @@ import { CONFIG } from '../initializers/config'
4 4
5const isCidr = require('is-cidr') 5const isCidr = require('is-cidr')
6 6
7async function isSignupAllowed () { 7async function isSignupAllowed (): Promise<{ allowed: boolean, errorMessage?: string }> {
8 if (CONFIG.SIGNUP.ENABLED === false) { 8 if (CONFIG.SIGNUP.ENABLED === false) {
9 return false 9 return { allowed: false }
10 } 10 }
11 11
12 // No limit and signup is enabled 12 // No limit and signup is enabled
13 if (CONFIG.SIGNUP.LIMIT === -1) { 13 if (CONFIG.SIGNUP.LIMIT === -1) {
14 return true 14 return { allowed: true }
15 } 15 }
16 16
17 const totalUsers = await UserModel.countTotal() 17 const totalUsers = await UserModel.countTotal()
18 18
19 return totalUsers < CONFIG.SIGNUP.LIMIT 19 return { allowed: totalUsers < CONFIG.SIGNUP.LIMIT }
20} 20}
21 21
22function isSignupAllowedForCurrentIP (ip: string) { 22function isSignupAllowedForCurrentIP (ip: string) {