Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Password constraint field consistency

Chocobozzz09b591a1ba3d
diff --git a/server/core/helpers/custom-validators/videos.ts b/server/core/helpers/custom-validators/videos.ts
index c8b01c12d0..8ef369ef84 100644
--- a/server/core/helpers/custom-validators/videos.ts
+++ b/server/core/helpers/custom-validators/videos.ts
@@ -152,8 +152,7 @@ export function isVideoMagnetUriValid (value: string) {
}
export function isPasswordValid (password: string) {
- return password.length >= CONSTRAINTS_FIELDS.VIDEO_PASSWORD.LENGTH.min &&
- password.length < CONSTRAINTS_FIELDS.VIDEO_PASSWORD.LENGTH.max
+ return validator.default.isLength(password, CONSTRAINTS_FIELDS.VIDEOS.PASSWORD)
}
export function isValidPasswordProtectedPrivacy (req: Request, res: Response) {
diff --git a/server/core/initializers/constants.ts b/server/core/initializers/constants.ts
index 2a8cd56f69..a6b0b21694 100644
--- a/server/core/initializers/constants.ts
+++ b/server/core/initializers/constants.ts
@@ -14,6 +14,8 @@ import {
PlayerThemeVideoSetting,
RunnerJobState,
RunnerJobStateType,
+ StreamSyncState,
+ StreamSyncStateType,
UploadImageType,
UploadImageType_Type,
UserExportState,
@@ -28,8 +30,6 @@ import {
VideoChannelActivityTargetType,
VideoChannelCollaboratorState,
VideoChannelCollaboratorStateType,
- StreamSyncState,
- StreamSyncStateType,
VideoCommentPolicy,
VideoCommentPolicyType,
VideoEmbedPrivacyPolicy,
@@ -469,7 +469,8 @@ export const CONSTRAINTS_FIELDS = {
DISLIKES: { min: 0 },
FILE_SIZE: { min: -1 },
PARTIAL_UPLOAD_SIZE: { max: 50 * 1024 * 1024 * 1024 }, // 50GB
- URL: { min: 3, max: 2000 } // Length
+ URL: { min: 3, max: 2000 }, // Length
+ PASSWORD: { min: 2, max: 100 } // Length
},
VIDEO_SOURCE: {
FILENAME: { min: 1, max: 1000 } // Length
@@ -550,9 +551,6 @@ export const CONSTRAINTS_FIELDS = {
ERROR_MESSAGE: { min: 1, max: 5000 }, // Length
PROGRESS: { min: 0, max: 100 } // Value
},
- VIDEO_PASSWORD: {
- LENGTH: { min: 2, max: 100 }
- },
VIDEO_CHAPTERS: {
TITLE: { min: 1, max: 100 } // Length
},