summary refs log tree commit diff
path: root/src/api/routes/auth/register.ts
diff options
context:
space:
mode:
authorMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2023-02-24 23:17:36 +1100
committerGitHub <noreply@github.com>2023-02-24 23:17:36 +1100
commit224e2c8374eee1bf85f6798123da4df90daf1860 (patch)
tree3d698d6b7392a061ff04d0dad145200377ed7fad /src/api/routes/auth/register.ts
parentFix gateway encoding Date objects as {} when using erlpack. Fixes NaN/NaN/NaN... (diff)
parentmove transporters to their own files (diff)
downloadserver-224e2c8374eee1bf85f6798123da4df90daf1860.tar.xz
Merge pull request #965 from Puyodead1/dev/mail
Email Support
Diffstat (limited to 'src/api/routes/auth/register.ts')
-rw-r--r--src/api/routes/auth/register.ts11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/api/routes/auth/register.ts b/src/api/routes/auth/register.ts
index 0bf8efae..c941fdf6 100644
--- a/src/api/routes/auth/register.ts
+++ b/src/api/routes/auth/register.ts
@@ -278,6 +278,17 @@ router.post(
 			await Invite.joinGuild(user.id, body.invite);
 		}
 
+		// return an error for unverified accounts if verification is required
+		if (Config.get().login.requireVerification && !user.verified) {
+			throw FieldErrors({
+				login: {
+					code: "ACCOUNT_LOGIN_VERIFICATION_EMAIL",
+					message:
+						"Email verification is required, please check your email.",
+				},
+			});
+		}
+
 		return res.json({ token: await generateToken(user.id) });
 	},
 );