]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/lib/signup.ts
More specific message when signup is not allowed
[github/Chocobozzz/PeerTube.git] / server / lib / signup.ts
index f19232621aa4e792db390d769cd11c2cb508ee4b..6702c22cbc57f7278cb74c720d169ad423de4248 100644 (file)
@@ -15,11 +15,11 @@ async function isSignupAllowed (options: {
   const { signupMode } = options
 
   if (CONFIG.SIGNUP.ENABLED === false) {
-    return { allowed: false }
+    return { allowed: false, errorMessage: 'User registration is not allowed' }
   }
 
   if (signupMode === 'direct-registration' && CONFIG.SIGNUP.REQUIRES_APPROVAL === true) {
-    return { allowed: false }
+    return { allowed: false, errorMessage: 'User registration requires approval' }
   }
 
   // No limit and signup is enabled
@@ -29,7 +29,7 @@ async function isSignupAllowed (options: {
 
   const totalUsers = await UserModel.countTotal()
 
-  return { allowed: totalUsers < CONFIG.SIGNUP.LIMIT }
+  return { allowed: totalUsers < CONFIG.SIGNUP.LIMIT, errorMessage: 'User limit is reached on this instance' }
 }
 
 function isSignupAllowedForCurrentIP (ip: string) {