diff options
author | Madeline <46743919+MaddyUnderStars@users.noreply.github.com> | 2023-02-24 23:17:36 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-24 23:17:36 +1100 |
commit | 224e2c8374eee1bf85f6798123da4df90daf1860 (patch) | |
tree | 3d698d6b7392a061ff04d0dad145200377ed7fad /src/api/routes/auth/register.ts | |
parent | Fix gateway encoding Date objects as {} when using erlpack. Fixes NaN/NaN/NaN... (diff) | |
parent | move transporters to their own files (diff) | |
download | server-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.ts | 11 |
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) }); }, ); |