diff options
Diffstat (limited to 'server/helpers')
-rw-r--r-- | server/helpers/signup.ts | 8 |
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 | ||
5 | const isCidr = require('is-cidr') | 5 | const isCidr = require('is-cidr') |
6 | 6 | ||
7 | async function isSignupAllowed () { | 7 | async 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 | ||
22 | function isSignupAllowedForCurrentIP (ip: string) { | 22 | function isSignupAllowedForCurrentIP (ip: string) { |