From 4ce7eb71ba28a563336c07d10c182ff89461c72b Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 25 Oct 2019 13:54:32 +0200 Subject: Add plugin hook on registration --- server/helpers/signup.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'server/helpers/signup.ts') 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' const isCidr = require('is-cidr') -async function isSignupAllowed () { +async function isSignupAllowed (): Promise<{ allowed: boolean, errorMessage?: string }> { if (CONFIG.SIGNUP.ENABLED === false) { - return false + return { allowed: false } } // No limit and signup is enabled if (CONFIG.SIGNUP.LIMIT === -1) { - return true + return { allowed: true } } const totalUsers = await UserModel.countTotal() - return totalUsers < CONFIG.SIGNUP.LIMIT + return { allowed: totalUsers < CONFIG.SIGNUP.LIMIT } } function isSignupAllowedForCurrentIP (ip: string) { -- cgit v1.2.3