From c379b849428aad4c7e40c07099c82b5cab09d87a Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Wed, 2 Oct 2024 22:39:09 +0530 Subject: [PATCH] feat: proxy password validation --- server/src/models/User.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/server/src/models/User.ts b/server/src/models/User.ts index 6430c50f..5e7c17e9 100644 --- a/server/src/models/User.ts +++ b/server/src/models/User.ts @@ -54,6 +54,13 @@ User.init( proxy_username: { type: DataTypes.STRING, allowNull: true, + validate: { + isProxyPasswordRequired(value: string | null) { + if (value && !this.proxy_password) { + throw new Error('Proxy password is required when proxy username is provided'); + } + }, + }, }, proxy_password: { type: DataTypes.STRING,