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,