prevent re-verifying email
This commit is contained in:
parent
b89c0987c2
commit
6ff8eec722
@ -39,7 +39,7 @@ router.post(
|
||||
async (req: Request, res: Response) => {
|
||||
const user = await User.findOneOrFail({
|
||||
where: { id: req.user_id },
|
||||
select: ["username", "email"],
|
||||
select: ["username", "email", "verified"],
|
||||
});
|
||||
|
||||
if (!user.email) {
|
||||
@ -47,6 +47,10 @@ router.post(
|
||||
throw new HTTPError("User does not have an email address", 400);
|
||||
}
|
||||
|
||||
if (user.verified) {
|
||||
throw new HTTPError("Email is already verified", 400);
|
||||
}
|
||||
|
||||
await Email.sendVerifyEmail(user, user.email)
|
||||
.then(() => {
|
||||
return res.sendStatus(204);
|
||||
|
||||
Reference in New Issue
Block a user