Skip to content

Commit dcd2b60

Browse files
dbeaver/pro#9370 check all passwords, not only the first one (#4357)
Co-authored-by: Evgenia <139753579+EvgeniaBzzz@users.noreply.github.com>
1 parent 84af14d commit dcd2b60

1 file changed

Lines changed: 14 additions & 7 deletions

File tree

webapp/packages/plugin-connections/src/ConnectionForm/Options/ConnectionFormOptionsPart.ts

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -386,18 +386,25 @@ export class ConnectionFormOptionsPart extends FormPart<IConnectionFormOptionsSt
386386
const authPropertiesInfo = this.connectionKey ? await this.connectionInfoAuthPropertiesResource.load(this.connectionKey) : undefined;
387387

388388
const properties = await this.getConnectionAuthModelProperties(this.state.authModelId, authPropertiesInfo);
389-
const passwordProperty = properties.find(property => property.features.includes('password'));
390-
const isPasswordEmpty =
391-
passwordProperty &&
392-
(this.state.credentials?.[passwordProperty.id!] === getObjectPropertyDefaultValue(passwordProperty) ||
393-
!this.state.credentials?.[passwordProperty.id!]);
389+
const passwordProperties = properties.filter(property => property.features.includes('password'));
394390

395391
if (isCredentialsChanged(properties, this.state.credentials!)) {
396392
this.state.credentials = prepareDynamicProperties(properties, toJS(this.state.credentials!));
397393
}
398394

399-
if (isPasswordEmpty) {
400-
delete this.state.credentials?.[passwordProperty.id!];
395+
if (passwordProperties.length > 0) {
396+
for (const passwordProperty of passwordProperties) {
397+
if (!passwordProperty.id) {
398+
continue;
399+
}
400+
401+
if (
402+
this.state.credentials?.[passwordProperty.id] === getObjectPropertyDefaultValue(passwordProperty) ||
403+
(!passwordProperty.features.includes('file') && !this.state.credentials?.[passwordProperty.id])
404+
) {
405+
delete this.state.credentials?.[passwordProperty.id];
406+
}
407+
}
401408
}
402409
}
403410

0 commit comments

Comments
 (0)