diff --git a/backend/src/app/controllers/user/crud/delete.ts b/backend/src/app/controllers/user/crud/delete.ts index 3d745b1..3e3e77e 100644 --- a/backend/src/app/controllers/user/crud/delete.ts +++ b/backend/src/app/controllers/user/crud/delete.ts @@ -1,4 +1,3 @@ -import EmailValidator from "email-validator"; import { Request, Response } from "express"; import Users from "../../../models/User"; import { LOGGER } from "../../../util/Logger"; diff --git a/backend/src/app/controllers/user/crud/get.ts b/backend/src/app/controllers/user/crud/get.ts index 09b7539..2eddad3 100644 --- a/backend/src/app/controllers/user/crud/get.ts +++ b/backend/src/app/controllers/user/crud/get.ts @@ -1,4 +1,3 @@ -import EmailValidator from "email-validator"; import { Request, Response } from "express"; import Users from "../../../models/User"; import { LOGGER } from "../../../util/Logger"; diff --git a/backend/src/app/controllers/user/crud/update.ts b/backend/src/app/controllers/user/crud/update.ts index 0e24c23..015551b 100644 --- a/backend/src/app/controllers/user/crud/update.ts +++ b/backend/src/app/controllers/user/crud/update.ts @@ -1,7 +1,7 @@ import { Request, Response } from "express"; +import ValidateEmail from "../../../email/templates/ValidateEmail"; import Users from "../../../models/User"; import { LOGGER } from "../../../util/Logger"; -import ValidateEmail from "../../../email/templates/ValidateEmail"; export default async (req: Request, res: Response) => { try { diff --git a/backend/src/app/middleware/UserInjection.ts b/backend/src/app/middleware/UserInjection.ts index 4d8d830..aa3f565 100644 --- a/backend/src/app/middleware/UserInjection.ts +++ b/backend/src/app/middleware/UserInjection.ts @@ -8,19 +8,14 @@ export default () => { return async (req: Request, res: Response, next: NextFunction) => { try { const token = req.header("authorization").replace("Bearer", "").trim(); - - if (!token) { - return next(); - } + if (!token) return next(); const { _id, expiresAt } = jwt.verify( token, process.env.JWT_SECRET as string ) as { _id: string; expiresAt: string }; - if (moment(moment()).isAfter(expiresAt)) { - return next(); - } + if (moment(moment()).isAfter(expiresAt)) return next(); const user = await Users.findById(_id); req.user = user.isEmailValidated ? user : null;