Merge remote-tracking branch 'origin/v9/dev' into v10/dev

This commit is contained in:
Bjarke Berg
2022-04-22 14:28:56 +02:00
2 changed files with 10 additions and 2 deletions

View File

@@ -72,7 +72,14 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
var enabledProviderNameHashSet = new HashSet<string>(await _twoFactorLoginService.GetEnabledTwoFactorProviderNamesAsync(user.Key));
var providerNames = await _backOfficeUserManager.GetValidTwoFactorProvidersAsync(user);
IEnumerable<string> providerNames = await _backOfficeUserManager.GetValidTwoFactorProvidersAsync(user);
// Filter out any providers that does not have a view attached to it, since it's unusable then.
providerNames = providerNames.Where(providerName =>
{
TwoFactorLoginViewOptions options = _twoFactorLoginViewOptions.Get(providerName);
return options is not null && !string.IsNullOrWhiteSpace(options.SetupViewPath);
});
return providerNames.Select(providerName =>
new UserTwoFactorProviderModel(providerName, enabledProviderNameHashSet.Contains(providerName))).ToArray();