diff options
Diffstat (limited to 'server')
-rw-r--r-- | server/lib/signup.ts | 6 | ||||
-rw-r--r-- | server/middlewares/validators/user-registrations.ts | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/server/lib/signup.ts b/server/lib/signup.ts index f19232621..6702c22cb 100644 --- a/server/lib/signup.ts +++ b/server/lib/signup.ts | |||
@@ -15,11 +15,11 @@ async function isSignupAllowed (options: { | |||
15 | const { signupMode } = options | 15 | const { signupMode } = options |
16 | 16 | ||
17 | if (CONFIG.SIGNUP.ENABLED === false) { | 17 | if (CONFIG.SIGNUP.ENABLED === false) { |
18 | return { allowed: false } | 18 | return { allowed: false, errorMessage: 'User registration is not allowed' } |
19 | } | 19 | } |
20 | 20 | ||
21 | if (signupMode === 'direct-registration' && CONFIG.SIGNUP.REQUIRES_APPROVAL === true) { | 21 | if (signupMode === 'direct-registration' && CONFIG.SIGNUP.REQUIRES_APPROVAL === true) { |
22 | return { allowed: false } | 22 | return { allowed: false, errorMessage: 'User registration requires approval' } |
23 | } | 23 | } |
24 | 24 | ||
25 | // No limit and signup is enabled | 25 | // No limit and signup is enabled |
@@ -29,7 +29,7 @@ async function isSignupAllowed (options: { | |||
29 | 29 | ||
30 | const totalUsers = await UserModel.countTotal() | 30 | const totalUsers = await UserModel.countTotal() |
31 | 31 | ||
32 | return { allowed: totalUsers < CONFIG.SIGNUP.LIMIT } | 32 | return { allowed: totalUsers < CONFIG.SIGNUP.LIMIT, errorMessage: 'User limit is reached on this instance' } |
33 | } | 33 | } |
34 | 34 | ||
35 | function isSignupAllowedForCurrentIP (ip: string) { | 35 | function isSignupAllowedForCurrentIP (ip: string) { |
diff --git a/server/middlewares/validators/user-registrations.ts b/server/middlewares/validators/user-registrations.ts index fcf655a2c..47397391b 100644 --- a/server/middlewares/validators/user-registrations.ts +++ b/server/middlewares/validators/user-registrations.ts | |||
@@ -59,7 +59,7 @@ function ensureUserRegistrationAllowedFactory (signupMode: SignupMode) { | |||
59 | if (allowedResult.allowed === false) { | 59 | if (allowedResult.allowed === false) { |
60 | return res.fail({ | 60 | return res.fail({ |
61 | status: HttpStatusCode.FORBIDDEN_403, | 61 | status: HttpStatusCode.FORBIDDEN_403, |
62 | message: allowedResult.errorMessage || 'User registration is not enabled, user limit is reached or registration requires approval.' | 62 | message: allowedResult.errorMessage || 'User registration is not allowed' |
63 | }) | 63 | }) |
64 | } | 64 | } |
65 | 65 | ||