diff options
author | Chocobozzz <me@florianbigard.com> | 2019-03-19 10:35:15 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-03-19 10:35:15 +0100 |
commit | dae86118ed5d4026d04acb9d0e36829b9ad8eb4e (patch) | |
tree | a5bf9c4487240bf75a9b328cad459a0587f90dea /server/middlewares/validators/users.ts | |
parent | e65c0c5b1fab9c3d93f51721b2458cf5cf471f20 (diff) | |
download | PeerTube-dae86118ed5d4026d04acb9d0e36829b9ad8eb4e.tar.gz PeerTube-dae86118ed5d4026d04acb9d0e36829b9ad8eb4e.tar.zst PeerTube-dae86118ed5d4026d04acb9d0e36829b9ad8eb4e.zip |
Cleanup express locals typings
Diffstat (limited to 'server/middlewares/validators/users.ts')
-rw-r--r-- | server/middlewares/validators/users.ts | 12 |
1 files changed, 6 insertions, 6 deletions
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 { | |||
14 | isUserRoleValid, | 14 | isUserRoleValid, |
15 | isUserUsernameValid, | 15 | isUserUsernameValid, |
16 | isUserVideoQuotaDailyValid, | 16 | isUserVideoQuotaDailyValid, |
17 | isUserVideoQuotaValid, isUserVideosHistoryEnabledValid | 17 | isUserVideoQuotaValid, |
18 | isUserVideosHistoryEnabledValid | ||
18 | } from '../../helpers/custom-validators/users' | 19 | } from '../../helpers/custom-validators/users' |
19 | import { doesVideoExist } from '../../helpers/custom-validators/videos' | 20 | import { doesVideoExist } from '../../helpers/custom-validators/videos' |
20 | import { logger } from '../../helpers/logger' | 21 | import { logger } from '../../helpers/logger' |
@@ -100,7 +101,7 @@ const usersBlockingValidator = [ | |||
100 | 101 | ||
101 | const deleteMeValidator = [ | 102 | const deleteMeValidator = [ |
102 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { | 103 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { |
103 | const user: UserModel = res.locals.oauth.token.User | 104 | const user = res.locals.oauth.token.User |
104 | if (user.username === 'root') { | 105 | if (user.username === 'root') { |
105 | return res.status(400) | 106 | return res.status(400) |
106 | .send({ error: 'You cannot delete your root account.' }) | 107 | .send({ error: 'You cannot delete your root account.' }) |
@@ -159,8 +160,7 @@ const usersUpdateMeValidator = [ | |||
159 | .end() | 160 | .end() |
160 | } | 161 | } |
161 | 162 | ||
162 | const user: UserModel = res.locals.oauth.token.User | 163 | const user= res.locals.oauth.token.User |
163 | |||
164 | if (await user.isPasswordMatch(req.body.currentPassword) !== true) { | 164 | if (await user.isPasswordMatch(req.body.currentPassword) !== true) { |
165 | return res.status(401) | 165 | return res.status(401) |
166 | .send({ error: 'currentPassword is invalid.' }) | 166 | .send({ error: 'currentPassword is invalid.' }) |
@@ -257,7 +257,7 @@ const usersResetPasswordValidator = [ | |||
257 | if (areValidationErrors(req, res)) return | 257 | if (areValidationErrors(req, res)) return |
258 | if (!await checkUserIdExist(req.params.id, res)) return | 258 | if (!await checkUserIdExist(req.params.id, res)) return |
259 | 259 | ||
260 | const user = res.locals.user as UserModel | 260 | const user = res.locals.user |
261 | const redisVerificationString = await Redis.Instance.getResetPasswordLink(user.id) | 261 | const redisVerificationString = await Redis.Instance.getResetPasswordLink(user.id) |
262 | 262 | ||
263 | if (redisVerificationString !== req.body.verificationString) { | 263 | if (redisVerificationString !== req.body.verificationString) { |
@@ -299,7 +299,7 @@ const usersVerifyEmailValidator = [ | |||
299 | if (areValidationErrors(req, res)) return | 299 | if (areValidationErrors(req, res)) return |
300 | if (!await checkUserIdExist(req.params.id, res)) return | 300 | if (!await checkUserIdExist(req.params.id, res)) return |
301 | 301 | ||
302 | const user = res.locals.user as UserModel | 302 | const user = res.locals.user |
303 | const redisVerificationString = await Redis.Instance.getVerifyEmailLink(user.id) | 303 | const redisVerificationString = await Redis.Instance.getVerifyEmailLink(user.id) |
304 | 304 | ||
305 | if (redisVerificationString !== req.body.verificationString) { | 305 | if (redisVerificationString !== req.body.verificationString) { |