addtional checks for if user is banned
This commit is contained in:
@@ -414,6 +414,14 @@ router.post(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if user is banned
|
||||||
|
if (user.isBanned) {
|
||||||
|
return res.status(403).json({
|
||||||
|
error: "Your account has been suspended. Please contact support for more information.",
|
||||||
|
code: "USER_BANNED",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Generate JWT tokens
|
// Generate JWT tokens
|
||||||
const token = jwt.sign(
|
const token = jwt.sign(
|
||||||
{ id: user.id, jwtVersion: user.jwtVersion },
|
{ id: user.id, jwtVersion: user.jwtVersion },
|
||||||
@@ -722,6 +730,14 @@ router.post("/refresh", async (req, res) => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if user is banned (defense-in-depth, jwtVersion should already catch this)
|
||||||
|
if (user.isBanned) {
|
||||||
|
return res.status(403).json({
|
||||||
|
error: "Your account has been suspended. Please contact support for more information.",
|
||||||
|
code: "USER_BANNED",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Generate new access token
|
// Generate new access token
|
||||||
const newAccessToken = jwt.sign(
|
const newAccessToken = jwt.sign(
|
||||||
{ id: user.id, jwtVersion: user.jwtVersion },
|
{ id: user.id, jwtVersion: user.jwtVersion },
|
||||||
|
|||||||
Reference in New Issue
Block a user