Fix username to respect existing values (#22837)

This commit is contained in:
Cheena Malhotra
2023-04-24 15:28:44 -07:00
committed by GitHub
parent 167ef2fea8
commit a887bb199e

View File

@@ -669,7 +669,7 @@ export class ConnectionWidget extends lifecycle.Disposable {
this._azureTenantDropdown.enable();
// Populate username as 'email' of selected azure account in dropdown, as username is required,
// and email of Azure account selected applies as username in most cases.
this._userNameInputBox.value = this._azureAccountList.find(a => a.displayInfo.displayName === this._azureAccountDropdown.value)?.displayInfo.email!
this._userNameInputBox.value = this.userName ?? this._azureAccountList.find(a => a.displayInfo.displayName === this._azureAccountDropdown.value)?.displayInfo.email!
?? this._azureAccountList[0]?.displayInfo?.email ?? '';
}).catch(err => this._logService.error(`Unexpected error populating Azure Account dropdown : ${err}`));
// Immediately show/hide appropriate elements though so user gets immediate feedback while we load accounts
@@ -783,7 +783,7 @@ export class ConnectionWidget extends lifecycle.Disposable {
selectedAccount = this._azureAccountList[0];
}
if (this.authenticationType === AuthenticationType.AzureMFAAndUser) {
if (this.authenticationType === AuthenticationType.AzureMFAAndUser && this._userNameInputBox.value === '') {
// Populate username as 'email' of selected azure account in dropdown, as username is required,
// and email of Azure account selected applies as username in most cases.
this._userNameInputBox.value = selectedAccount?.displayInfo?.email! ?? '';