summary refs log tree commit diff
path: root/api/src/routes/auth/register.ts
diff options
context:
space:
mode:
authorMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-07-20 15:33:27 +1000
committerMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-07-20 15:33:27 +1000
commitaaf0499017091587037e96b61a4894a40f13e0e7 (patch)
tree6de5045a2c3b1501646b12e07a6e024a556765cd /api/src/routes/auth/register.ts
parentCaptcha required message on login/register (diff)
parentCaptcha checking (diff)
downloadserver-aaf0499017091587037e96b61a4894a40f13e0e7.tar.xz
Merge branch 'feat/captchaVerify' into slowcord
Diffstat (limited to 'api/src/routes/auth/register.ts')
-rw-r--r--api/src/routes/auth/register.ts8
1 files changed, 4 insertions, 4 deletions
diff --git a/api/src/routes/auth/register.ts b/api/src/routes/auth/register.ts
index dd5aae84..f74d0d63 100644
--- a/api/src/routes/auth/register.ts
+++ b/api/src/routes/auth/register.ts
@@ -1,6 +1,6 @@
 import { Request, Response, Router } from "express";
 import { Config, generateToken, Invite, FieldErrors, User, adjustEmail } from "@fosscord/util";
-import { route, getIpAdress, IPAnalysis, isProxy, verifyHcaptcha } from "@fosscord/api";
+import { route, getIpAdress, IPAnalysis, isProxy, verifyCaptcha } from "@fosscord/api";
 import "missing-native-js-functions";
 import bcrypt from "bcrypt";
 import { HTTPError } from "lambert-server";
@@ -67,16 +67,16 @@ router.post("/", route({ body: "RegisterSchema" }), async (req: Request, res: Re
 	}
 
 	if (register.requireCaptcha && security.captcha.enabled) {
-		const { sitekey, service, secret } = security.captcha;
+		const { sitekey, service } = security.captcha;
 		if (!body.captcha_key) {
-			return res.status(400).json({
+			return res?.status(400).json({
 				captcha_key: ["captcha-required"],
 				captcha_sitekey: sitekey,
 				captcha_service: service
 			});
 		}
 
-		const verify = await verifyHcaptcha(body.captcha_key, ip);
+		const verify = await verifyCaptcha(body.captcha_key, ip);
 		if (!verify.success) {
 			return res.status(400).json({
 				captcha_key: verify["error-codes"],