mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-22 01:25:38 -05:00
Pre-populate username for selected user account (AzureMFAAndUser) (#22126)
This commit is contained in:
@@ -646,6 +646,10 @@ export class ConnectionWidget extends lifecycle.Disposable {
|
||||
// Populate tenants (select first by default for initialization of tenant dialog)
|
||||
await this.onAzureAccountSelected(true);
|
||||
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._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
|
||||
this._tableContainer.classList.remove('hide-username');
|
||||
@@ -757,6 +761,13 @@ export class ConnectionWidget extends lifecycle.Disposable {
|
||||
if (!selectedAccount && selectFirstByDefault && this._azureAccountList.length > 0) {
|
||||
selectedAccount = this._azureAccountList[0];
|
||||
}
|
||||
|
||||
if (this.authenticationType === AuthenticationType.AzureMFAAndUser) {
|
||||
// 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! ?? '';
|
||||
}
|
||||
|
||||
if (selectedAccount && selectedAccount.properties.tenants && selectedAccount.properties.tenants.length > 1) {
|
||||
// There are multiple tenants available so let the user select one
|
||||
let options = selectedAccount.properties.tenants.map(tenant => tenant.displayName);
|
||||
|
||||
Reference in New Issue
Block a user