From dae86118ed5d4026d04acb9d0e36829b9ad8eb4e Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 19 Mar 2019 10:35:15 +0100 Subject: Cleanup express locals typings --- server/middlewares/validators/users.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'server/middlewares/validators/users.ts') diff --git a/server/middlewares/validators/users.ts b/server/middlewares/validators/users.ts index 5e8c8c29b..e8ade0f97 100644 --- a/server/middlewares/validators/users.ts +++ b/server/middlewares/validators/users.ts @@ -14,7 +14,8 @@ import { isUserRoleValid, isUserUsernameValid, isUserVideoQuotaDailyValid, - isUserVideoQuotaValid, isUserVideosHistoryEnabledValid + isUserVideoQuotaValid, + isUserVideosHistoryEnabledValid } from '../../helpers/custom-validators/users' import { doesVideoExist } from '../../helpers/custom-validators/videos' import { logger } from '../../helpers/logger' @@ -100,7 +101,7 @@ const usersBlockingValidator = [ const deleteMeValidator = [ async (req: express.Request, res: express.Response, next: express.NextFunction) => { - const user: UserModel = res.locals.oauth.token.User + const user = res.locals.oauth.token.User if (user.username === 'root') { return res.status(400) .send({ error: 'You cannot delete your root account.' }) @@ -159,8 +160,7 @@ const usersUpdateMeValidator = [ .end() } - const user: UserModel = res.locals.oauth.token.User - + const user= res.locals.oauth.token.User if (await user.isPasswordMatch(req.body.currentPassword) !== true) { return res.status(401) .send({ error: 'currentPassword is invalid.' }) @@ -257,7 +257,7 @@ const usersResetPasswordValidator = [ if (areValidationErrors(req, res)) return if (!await checkUserIdExist(req.params.id, res)) return - const user = res.locals.user as UserModel + const user = res.locals.user const redisVerificationString = await Redis.Instance.getResetPasswordLink(user.id) if (redisVerificationString !== req.body.verificationString) { @@ -299,7 +299,7 @@ const usersVerifyEmailValidator = [ if (areValidationErrors(req, res)) return if (!await checkUserIdExist(req.params.id, res)) return - const user = res.locals.user as UserModel + const user = res.locals.user const redisVerificationString = await Redis.Instance.getVerifyEmailLink(user.id) if (redisVerificationString !== req.body.verificationString) { -- cgit v1.2.3