send required_action in gateway for when email verification is required

This commit is contained in:
Madeline 2023-02-24 23:46:52 +11:00
parent f507e15326
commit 51fe1b8955
2 changed files with 6 additions and 11 deletions

View File

@ -278,17 +278,6 @@ router.post(
await Invite.joinGuild(user.id, body.invite); 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) }); return res.json({ token: await generateToken(user.id) });
}, },
); );

View File

@ -320,6 +320,12 @@ export async function onIdentify(this: WebSocket, data: Payload) {
merged_members: merged_members, merged_members: merged_members,
// shard // TODO: only for user sharding // shard // TODO: only for user sharding
sessions: [], // TODO: sessions: [], // TODO:
// lol hack whatever
required_action:
Config.get().login.requireVerification && !user.verified
? "REQUIRE_VERIFIED_EMAIL"
: undefined,
}; };
// TODO: send real proper data structure // TODO: send real proper data structure