isUserRoleValid,
isUserUsernameValid,
isUserVideoQuotaDailyValid,
- isUserVideoQuotaValid, isUserVideosHistoryEnabledValid
+ isUserVideoQuotaValid,
+ isUserVideosHistoryEnabledValid
} from '../../helpers/custom-validators/users'
-import { isVideoExist } from '../../helpers/custom-validators/videos'
+import { doesVideoExist } from '../../helpers/custom-validators/videos'
import { logger } from '../../helpers/logger'
import { isSignupAllowed, isSignupAllowedForCurrentIP } from '../../helpers/signup'
import { Redis } from '../../lib/redis'
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.' })
.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.' })
logger.debug('Checking usersVideoRating parameters', { parameters: req.params })
if (areValidationErrors(req, res)) return
- if (!await isVideoExist(req.params.videoId, res, 'id')) return
+ if (!await doesVideoExist(req.params.videoId, res, 'id')) return
return next()
}
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) {
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) {