mirror of
https://github.com/bitwarden/server.git
synced 2025-12-10 00:42:07 -06:00
Refactor TwoFactorIsEnabledQuery to improve handling of users without two-factor providers. Added early exit for users lacking providers and streamlined premium status checks for enabled two-factor authentication.
This commit is contained in:
parent
245ce712ba
commit
0279cb5e8a
@ -148,9 +148,15 @@ public class TwoFactorIsEnabledQuery : ITwoFactorIsEnabledQuery
|
||||
foreach (var user in users)
|
||||
{
|
||||
var userTwoFactorProviders = usersTwoFactorProvidersMap[user.Id];
|
||||
var twoFactorIsEnabled = userTwoFactorProviders.Any() &&
|
||||
(!premiumStatusMap.TryGetValue(user.Id, out var hasPremium) || hasPremium);
|
||||
|
||||
if (!userTwoFactorProviders.Any())
|
||||
{
|
||||
result.Add((user.Id, false));
|
||||
continue;
|
||||
}
|
||||
|
||||
// User has providers. If they're in the premium check map, verify premium status
|
||||
var twoFactorIsEnabled = !premiumStatusMap.TryGetValue(user.Id, out var hasPremium) || hasPremium;
|
||||
result.Add((user.Id, twoFactorIsEnabled));
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user