Don't check current password param

We may have a current password that does not satisfy new password
constraints
pull/6527/head
Chocobozzz 2024-07-31 08:25:50 +02:00
parent 5f153b9d85
commit d0304f6712
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
1 changed files with 7 additions and 21 deletions

View File

@ -1,7 +1,7 @@
import express from 'express'
import { body, param, query } from 'express-validator'
import { forceNumber } from '@peertube/peertube-core-utils' import { forceNumber } from '@peertube/peertube-core-utils'
import { HttpStatusCode, UserRight, UserRole } from '@peertube/peertube-models' import { HttpStatusCode, UserRight, UserRole } from '@peertube/peertube-models'
import express from 'express'
import { body, param, query } from 'express-validator'
import { exists, isBooleanValid, isIdValid, toBooleanOrNull, toIntOrNull } from '../../../helpers/custom-validators/misc.js' import { exists, isBooleanValid, isIdValid, toBooleanOrNull, toIntOrNull } from '../../../helpers/custom-validators/misc.js'
import { isThemeNameValid } from '../../../helpers/custom-validators/plugins.js' import { isThemeNameValid } from '../../../helpers/custom-validators/plugins.js'
import { import {
@ -31,10 +31,10 @@ import { Redis } from '../../../lib/redis.js'
import { ActorModel } from '../../../models/actor/actor.js' import { ActorModel } from '../../../models/actor/actor.js'
import { import {
areValidationErrors, areValidationErrors,
checkUserCanManageAccount,
checkUserEmailExist, checkUserEmailExist,
checkUserIdExist, checkUserIdExist,
checkUserNameOrEmailDoNotAlreadyExist, checkUserNameOrEmailDoNotAlreadyExist,
checkUserCanManageAccount,
doesVideoChannelIdExist, doesVideoChannelIdExist,
doesVideoExist, doesVideoExist,
isValidVideoIdParam isValidVideoIdParam
@ -211,7 +211,7 @@ const usersUpdateMeValidator = [
.custom(isUserDescriptionValid), .custom(isUserDescriptionValid),
body('currentPassword') body('currentPassword')
.optional() .optional()
.custom(isUserPasswordValid), .custom(exists),
body('password') body('password')
.optional() .optional()
.custom(isUserPasswordValid), .custom(isUserPasswordValid),
@ -457,21 +457,7 @@ const ensureCanModerateUser = [
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
export { export {
usersListValidator, deleteMeValidator, ensureAuthUserOwnsAccountValidator, ensureCanManageChannelOrAccount, ensureCanModerateUser, userAutocompleteValidator, usersAddValidator, usersAskResetPasswordValidator, usersBlockingValidator, usersCheckCurrentPasswordFactory,
usersAddValidator, usersGetValidator, usersListValidator, usersRemoveValidator, usersResetPasswordValidator, usersUpdateMeValidator, usersUpdateValidator, usersVideoRatingValidator, usersVideosValidator
deleteMeValidator,
usersBlockingValidator,
usersRemoveValidator,
usersUpdateValidator,
usersUpdateMeValidator,
usersVideoRatingValidator,
usersCheckCurrentPasswordFactory,
usersGetValidator,
usersVideosValidator,
usersAskResetPasswordValidator,
usersResetPasswordValidator,
userAutocompleteValidator,
ensureAuthUserOwnsAccountValidator,
ensureCanModerateUser,
ensureCanManageChannelOrAccount
} }