mirror of
https://github.com/bluewave-labs/Checkmate.git
synced 2026-05-05 16:09:48 -05:00
Add token expired msg
This commit is contained in:
@@ -38,6 +38,11 @@ const verifyJWT = (req, res, next) => {
|
||||
const { jwtSecret } = req.settingsService.getSettings();
|
||||
jwt.verify(parsedToken, jwtSecret, (err, decoded) => {
|
||||
if (err) {
|
||||
if (err.name === "TokenExpiredError") {
|
||||
res
|
||||
.status(401)
|
||||
.json({ success: false, msg: errorMessages.EXPIRED_AUTH_TOKEN });
|
||||
}
|
||||
return res
|
||||
.status(401)
|
||||
.json({ success: false, msg: errorMessages.INVALID_AUTH_TOKEN });
|
||||
|
||||
@@ -12,6 +12,7 @@ const errorMessages = {
|
||||
UNKNOWN_SERVICE: "Unknown service",
|
||||
NO_AUTH_TOKEN: "No auth token provided",
|
||||
INVALID_AUTH_TOKEN: "Invalid auth token",
|
||||
EXPIRED_AUTH_TOKEN: "Token expired",
|
||||
|
||||
//Ownership Middleware
|
||||
VERIFY_OWNER_NOT_FOUND: "Document not found",
|
||||
@@ -93,7 +94,8 @@ const successMessages = {
|
||||
|
||||
//Maintenance Window Controller
|
||||
MAINTENANCE_WINDOW_CREATE: "Maintenance Window created successfully",
|
||||
MAINTENANCE_WINDOW_GET_BY_USER: "Got Maintenance Windows by User successfully",
|
||||
MAINTENANCE_WINDOW_GET_BY_USER:
|
||||
"Got Maintenance Windows by User successfully",
|
||||
|
||||
//Ping Operations
|
||||
PING_SUCCESS: "Success",
|
||||
|
||||
Reference in New Issue
Block a user