send required_action in gateway for when email verification is required
This commit is contained in:
parent
f507e15326
commit
51fe1b8955
@ -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) });
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
@ -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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user