summary refs log tree commit diff
path: root/api/src
diff options
context:
space:
mode:
authorFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-10-01 20:11:05 +0200
committerFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-10-01 20:11:05 +0200
commit966fec29534143565d1298ada9260a82c1132440 (patch)
tree7e36e168df2fa6157a2b5d90e79397852ebc9a5e /api/src
parentMerge branch 'master' of http://github.com/fosscord/fosscord-server (diff)
downloadserver-966fec29534143565d1298ada9260a82c1132440.tar.xz
:sparkles: registration disabled notice
Diffstat (limited to 'api/src')
-rw-r--r--api/src/routes/auth/register.ts9
1 files changed, 9 insertions, 0 deletions
diff --git a/api/src/routes/auth/register.ts b/api/src/routes/auth/register.ts
index 9c058399..75fa68c3 100644
--- a/api/src/routes/auth/register.ts
+++ b/api/src/routes/auth/register.ts
@@ -50,6 +50,15 @@ router.post("/", route({ body: "RegisterSchema" }), async (req: Request, res: Re
 	const { register, security } = Config.get();
 	const ip = getIpAdress(req);
 
+	if (register.disabled) {
+		throw FieldErrors({
+			email: {
+				code: "DISABLED",
+				message: "registration is disabled on this instance"
+			}
+		});
+	}
+
 	if (register.blockProxies) {
 		if (isProxy(await IPAnalysis(ip))) {
 			console.log(`proxy ${ip} blocked from registration`);