aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/validators/users.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/middlewares/validators/users.ts')
-rw-r--r--server/middlewares/validators/users.ts12
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'
19import { doesVideoExist } from '../../helpers/custom-validators/videos' 20import { doesVideoExist } from '../../helpers/custom-validators/videos'
20import { logger } from '../../helpers/logger' 21import { logger } from '../../helpers/logger'
@@ -100,7 +101,7 @@ const usersBlockingValidator = [
100 101
101const deleteMeValidator = [ 102const 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) {